From: <ze...@us...> - 2007-03-21 07:20:33
|
Revision: 204 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=204&view=rev Author: zebons Date: 2007-03-21 00:20:31 -0700 (Wed, 21 Mar 2007) Log Message: ----------- Language modifications : add a default value for all MP languages Modified Paths: -------------- trunk/plugins/mpinstaler/MPInstaler/Language dialog.Designer.cs trunk/plugins/mpinstaler/MPInstaler/Language dialog.cs Modified: trunk/plugins/mpinstaler/MPInstaler/Language dialog.Designer.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/Language dialog.Designer.cs 2007-03-20 19:00:01 UTC (rev 203) +++ trunk/plugins/mpinstaler/MPInstaler/Language dialog.Designer.cs 2007-03-21 07:20:31 UTC (rev 204) @@ -39,7 +39,6 @@ this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); this.listView2 = new System.Windows.Forms.ListView(); this.columnHeader4 = new System.Windows.Forms.ColumnHeader(); this.columnHeader5 = new System.Windows.Forms.ColumnHeader(); @@ -47,13 +46,15 @@ this.button6 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); + this.languageComboBox2 = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(25, 279); + this.button1.Location = new System.Drawing.Point(12, 291); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(65, 21); this.button1.TabIndex = 0; @@ -65,7 +66,7 @@ // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.button2.Location = new System.Drawing.Point(216, 279); + this.button2.Location = new System.Drawing.Point(180, 291); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(65, 21); this.button2.TabIndex = 1; @@ -81,7 +82,6 @@ this.languageComboBox.Name = "languageComboBox"; this.languageComboBox.Size = new System.Drawing.Size(168, 21); this.languageComboBox.TabIndex = 2; - this.languageComboBox.SelectedIndexChanged += new System.EventHandler(this.languageComboBox_SelectedIndexChanged); // // listView1 // @@ -138,7 +138,7 @@ // this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.button3.Location = new System.Drawing.Point(571, 291); + this.button3.Location = new System.Drawing.Point(545, 302); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(65, 21); this.button3.TabIndex = 6; @@ -146,16 +146,6 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // - // comboBox1 - // - this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(13, 306); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(371, 21); - this.comboBox1.TabIndex = 8; - // // listView2 // this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -167,7 +157,7 @@ this.listView2.HideSelection = false; this.listView2.Location = new System.Drawing.Point(434, 12); this.listView2.Name = "listView2"; - this.listView2.Size = new System.Drawing.Size(227, 261); + this.listView2.Size = new System.Drawing.Size(227, 235); this.listView2.TabIndex = 9; this.listView2.UseCompatibleStateImageBehavior = false; this.listView2.View = System.Windows.Forms.View.Details; @@ -196,7 +186,7 @@ // this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.button6.Location = new System.Drawing.Point(113, 279); + this.button6.Location = new System.Drawing.Point(83, 291); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(76, 21); this.button6.TabIndex = 11; @@ -208,7 +198,7 @@ // this.button7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.button7.Location = new System.Drawing.Point(479, 291); + this.button7.Location = new System.Drawing.Point(322, 291); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(65, 21); this.button7.TabIndex = 12; @@ -220,7 +210,7 @@ // this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.button8.Location = new System.Drawing.Point(302, 279); + this.button8.Location = new System.Drawing.Point(251, 291); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(65, 21); this.button8.TabIndex = 13; @@ -228,17 +218,37 @@ this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click); // + // languageComboBox2 + // + this.languageComboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.languageComboBox2.FormattingEnabled = true; + this.languageComboBox2.Location = new System.Drawing.Point(517, 253); + this.languageComboBox2.Name = "languageComboBox2"; + this.languageComboBox2.Size = new System.Drawing.Size(144, 21); + this.languageComboBox2.TabIndex = 14; + this.languageComboBox2.SelectedIndexChanged += new System.EventHandler(this.languageComboBox2_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(433, 256); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(78, 13); + this.label1.TabIndex = 15; + this.label1.Text = "Ref. Language"; + // // Form2 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(673, 335); + this.Controls.Add(this.label1); + this.Controls.Add(this.languageComboBox2); this.Controls.Add(this.button8); this.Controls.Add(this.button7); this.Controls.Add(this.button6); this.Controls.Add(this.button5); this.Controls.Add(this.listView2); - this.Controls.Add(this.comboBox1); this.Controls.Add(this.button3); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); @@ -269,7 +279,6 @@ private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button button3; private System.Windows.Forms.ColumnHeader columnHeader3; - private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ListView listView2; private System.Windows.Forms.Button button5; private System.Windows.Forms.ColumnHeader columnHeader4; @@ -277,5 +286,7 @@ private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button8; + private System.Windows.Forms.ComboBox languageComboBox2; + private System.Windows.Forms.Label label1; } } \ No newline at end of file Modified: trunk/plugins/mpinstaler/MPInstaler/Language dialog.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/Language dialog.cs 2007-03-20 19:00:01 UTC (rev 203) +++ trunk/plugins/mpinstaler/MPInstaler/Language dialog.cs 2007-03-21 07:20:31 UTC (rev 204) @@ -50,45 +50,40 @@ { fileName = fileName.Substring(0, 1).ToUpper() + fileName.Substring(1); languageComboBox.Items.Add(fileName); + languageComboBox2.Items.Add(fileName); // Check language file to user region language if (fileName.ToLower() == strLongLanguage.ToLower()) { - languageComboBox.Text = fileName; + languageComboBox2.Text = fileName; bExactLanguageFound = true; } else if (!bExactLanguageFound && (fileName.ToLower() == strShortLanguage.ToLower())) { - languageComboBox.Text = fileName; + languageComboBox2.Text = fileName; } } } } } - if (languageComboBox.Text == "") + if (languageComboBox2.Text == "") { - languageComboBox.Text = "English"; + languageComboBox2.Text = "English"; } } private void button1_Click(object sender, EventArgs e) { - for (int i = 0; i < listView1.Items.Count; i++) + if (textBox1.Text.Length == 0) { - if ((languageComboBox.Text == listView1.Items[i].SubItems[2].Text) && (textBox1.Text == listView1.SelectedItems[i].SubItems[0].Text)) - { - listView1.SelectedItems[i].SubItems[1].Text = textBox2.Text; - return; - } + MessageBox.Show("ID is mandatory !", "Stop"); + textBox1.Focus(); + return; } - ListViewItem item1 = new ListViewItem(textBox1.Text, 0); - item1.SubItems.Add(textBox2.Text); - item1.SubItems.Add(languageComboBox.Text); - listView1.Items.AddRange(new ListViewItem[] { item1 }); + update_listview1(textBox1.Text, textBox2.Text, languageComboBox.Text); + } - } - private void button2_Click(object sender, EventArgs e) { foreach (int index in listView1.SelectedIndices) @@ -107,11 +102,11 @@ item1.SubItems.Add(lg.language); listView1.Items.AddRange(new ListViewItem[] { item1 }); } - comboBox1.Items.Clear(); - foreach (LanguageString lg in deflang.Language) - { - comboBox1.Items.Add(lg.dwCode+" - " + lg.mapSting); - } + //comboBox1.Items.Clear(); + //foreach (LanguageString lg in deflang.Language) + //{ + // comboBox1.Items.Add(lg.dwCode+" - " + lg.mapSting); + //} load_lang(); } @@ -139,9 +134,9 @@ this.Close(); } - private void languageComboBox_SelectedIndexChanged(object sender, EventArgs e) + private void languageComboBox2_SelectedIndexChanged(object sender, EventArgs e) { - lang.Load(languageComboBox.Text); + lang.Load(languageComboBox2.Text); load_lang(); } @@ -151,7 +146,7 @@ { ListViewItem item1 = new ListViewItem(it.SubItems[0].Text, 0); item1.SubItems.Add(it.SubItems[1].Text); - item1.SubItems.Add(languageComboBox.Text); + item1.SubItems.Add(languageComboBox2.Text); listView1.Items.AddRange(new ListViewItem[] { item1 }); } } @@ -171,6 +166,23 @@ private void button6_Click(object sender, EventArgs e) { + if (textBox1.Text.Length == 0) + { + MessageBox.Show("ID is mandatory ! You have to give the refence value first !", "Stop"); + textBox1.Focus(); + return; + } + string message = "The value '" + textBox2.Text + "' will be used for ID " + textBox1.Text + " as default value. Do you confirm ?"; + string caption = "Confirmation"; + MessageBoxButtons buttons = MessageBoxButtons.YesNo; + DialogResult result; + + // Displays the MessageBox. + + result = MessageBox.Show(message, caption, buttons); + + if(result == DialogResult.No) + return; MPLanguageHelper mplh = new MPLanguageHelper(); foreach (string lg in languageComboBox.Items) { @@ -186,11 +198,17 @@ } if (idx > -1) { + update_listview1(mplh.Language[idx].dwCode, mplh.Language[idx].mapSting, lg); + ListViewItem item1 = new ListViewItem(mplh.Language[idx].dwCode, 0); item1.SubItems.Add(mplh.Language[idx].mapSting); item1.SubItems.Add(lg); listView1.Items.AddRange(new ListViewItem[] { item1 }); } + else + { + update_listview1(textBox1.Text, textBox2.Text, lg); + } } } } @@ -210,5 +228,20 @@ { listView1.Items.Clear(); } - } + private void update_listview1(string wid, string wval, string wlang) + { + for (int i = 0; i < listView1.Items.Count; i++) + { + if ((wlang == listView1.Items[i].SubItems[2].Text) && (wid == listView1.Items[i].SubItems[0].Text)) + { + listView1.Items.RemoveAt(i); + break; + } + } + ListViewItem item1 = new ListViewItem(wid, 0); + item1.SubItems.Add(wval); + item1.SubItems.Add(wlang); + listView1.Items.AddRange(new ListViewItem[] { item1 }); + } + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |