|
From: <du...@us...> - 2007-04-30 12:39:19
|
Revision: 358
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=358&view=rev
Author: dukus
Date: 2007-04-30 05:39:13 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Grouping interface in editor
Modified Paths:
--------------
trunk/plugins/mpinstaler/MPInstaler/Form1.cs
trunk/plugins/mpinstaler/MPInstaler/GroupForm.Designer.cs
trunk/plugins/mpinstaler/MPInstaler/GroupForm.cs
trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs
trunk/plugins/mpinstaler/MPInstaler/properties.cs
Modified: trunk/plugins/mpinstaler/MPInstaler/Form1.cs
===================================================================
--- trunk/plugins/mpinstaler/MPInstaler/Form1.cs 2007-04-30 08:01:48 UTC (rev 357)
+++ trunk/plugins/mpinstaler/MPInstaler/Form1.cs 2007-04-30 12:39:13 UTC (rev 358)
@@ -580,6 +580,7 @@
private void setupGroupsToolStripMenuItem_Click(object sender, EventArgs e)
{
GroupForm dlg = new GroupForm();
+ dlg._struct = this._struct;
dlg.ShowDialog();
}
}
Modified: trunk/plugins/mpinstaler/MPInstaler/GroupForm.Designer.cs
===================================================================
--- trunk/plugins/mpinstaler/MPInstaler/GroupForm.Designer.cs 2007-04-30 08:01:48 UTC (rev 357)
+++ trunk/plugins/mpinstaler/MPInstaler/GroupForm.Designer.cs 2007-04-30 12:39:13 UTC (rev 358)
@@ -32,7 +32,23 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
+ this.listView1 = new System.Windows.Forms.ListView();
+ this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
+ this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
+ this.listView2 = new System.Windows.Forms.ListView();
+ this.listView3 = new System.Windows.Forms.ListView();
+ this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
+ this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.button4 = new System.Windows.Forms.Button();
+ this.button5 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
@@ -47,23 +63,34 @@
//
// tabPage1
//
+ this.tabPage1.Controls.Add(this.button5);
+ this.tabPage1.Controls.Add(this.button4);
+ this.tabPage1.Controls.Add(this.textBox2);
+ this.tabPage1.Controls.Add(this.textBox1);
+ this.tabPage1.Controls.Add(this.listView1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(477, 209);
this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "tabPage1";
+ this.tabPage1.Text = "Groups";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
+ this.tabPage2.Controls.Add(this.button3);
+ this.tabPage2.Controls.Add(this.button2);
+ this.tabPage2.Controls.Add(this.listView3);
+ this.tabPage2.Controls.Add(this.listView2);
+ this.tabPage2.Controls.Add(this.comboBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(477, 209);
this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "tabPage2";
+ this.tabPage2.Text = "Groups mapping";
this.tabPage2.UseVisualStyleBackColor = true;
+ this.tabPage2.Enter += new System.EventHandler(this.tabPage2_Enter);
//
// button1
//
@@ -75,6 +102,125 @@
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
+ // listView1
+ //
+ this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader1,
+ this.columnHeader2});
+ this.listView1.FullRowSelect = true;
+ this.listView1.Location = new System.Drawing.Point(6, 6);
+ this.listView1.Name = "listView1";
+ this.listView1.Size = new System.Drawing.Size(465, 135);
+ this.listView1.TabIndex = 0;
+ this.listView1.UseCompatibleStateImageBehavior = false;
+ this.listView1.View = System.Windows.Forms.View.Details;
+ this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDoubleClick);
+ this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick);
+ //
+ // columnHeader1
+ //
+ this.columnHeader1.Text = "id";
+ //
+ // columnHeader2
+ //
+ this.columnHeader2.Text = "Name";
+ this.columnHeader2.Width = 372;
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(6, 147);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(53, 20);
+ this.textBox1.TabIndex = 1;
+ //
+ // textBox2
+ //
+ this.textBox2.Location = new System.Drawing.Point(65, 147);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(406, 20);
+ this.textBox2.TabIndex = 2;
+ //
+ // comboBox1
+ //
+ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBox1.FormattingEnabled = true;
+ this.comboBox1.Location = new System.Drawing.Point(6, 6);
+ this.comboBox1.Name = "comboBox1";
+ this.comboBox1.Size = new System.Drawing.Size(465, 21);
+ this.comboBox1.TabIndex = 0;
+ this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
+ //
+ // listView2
+ //
+ this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader3});
+ this.listView2.Location = new System.Drawing.Point(6, 33);
+ this.listView2.Name = "listView2";
+ this.listView2.Size = new System.Drawing.Size(170, 170);
+ this.listView2.TabIndex = 1;
+ this.listView2.UseCompatibleStateImageBehavior = false;
+ this.listView2.View = System.Windows.Forms.View.Details;
+ //
+ // listView3
+ //
+ this.listView3.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader4});
+ this.listView3.Location = new System.Drawing.Point(270, 33);
+ this.listView3.Name = "listView3";
+ this.listView3.Size = new System.Drawing.Size(200, 169);
+ this.listView3.TabIndex = 2;
+ this.listView3.UseCompatibleStateImageBehavior = false;
+ this.listView3.View = System.Windows.Forms.View.Details;
+ //
+ // columnHeader3
+ //
+ this.columnHeader3.Text = "File name";
+ this.columnHeader3.Width = 162;
+ //
+ // columnHeader4
+ //
+ this.columnHeader4.Text = "Filename";
+ this.columnHeader4.Width = 191;
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(196, 85);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(49, 21);
+ this.button2.TabIndex = 3;
+ this.button2.Text = "->";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // button3
+ //
+ this.button3.Location = new System.Drawing.Point(196, 124);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(49, 22);
+ this.button3.TabIndex = 4;
+ this.button3.Text = "<-";
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
+ //
+ // button4
+ //
+ this.button4.Location = new System.Drawing.Point(315, 173);
+ this.button4.Name = "button4";
+ this.button4.Size = new System.Drawing.Size(75, 23);
+ this.button4.TabIndex = 3;
+ this.button4.Text = "Add";
+ this.button4.UseVisualStyleBackColor = true;
+ this.button4.Click += new System.EventHandler(this.button4_Click);
+ //
+ // button5
+ //
+ this.button5.Location = new System.Drawing.Point(396, 173);
+ this.button5.Name = "button5";
+ this.button5.Size = new System.Drawing.Size(75, 23);
+ this.button5.TabIndex = 4;
+ this.button5.Text = "Remove";
+ this.button5.UseVisualStyleBackColor = true;
+ //
// GroupForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -84,7 +230,11 @@
this.Controls.Add(this.tabControl1);
this.Name = "GroupForm";
this.Text = "GroupForm";
+ this.Load += new System.EventHandler(this.GroupForm_Load);
this.tabControl1.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.tabPage1.PerformLayout();
+ this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -95,5 +245,19 @@
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.ListView listView1;
+ private System.Windows.Forms.ColumnHeader columnHeader1;
+ private System.Windows.Forms.ColumnHeader columnHeader2;
+ private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.ComboBox comboBox1;
+ private System.Windows.Forms.ListView listView3;
+ private System.Windows.Forms.ColumnHeader columnHeader4;
+ private System.Windows.Forms.ListView listView2;
+ private System.Windows.Forms.ColumnHeader columnHeader3;
+ private System.Windows.Forms.Button button4;
+ private System.Windows.Forms.Button button3;
+ private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.Button button5;
}
}
\ No newline at end of file
Modified: trunk/plugins/mpinstaler/MPInstaler/GroupForm.cs
===================================================================
--- trunk/plugins/mpinstaler/MPInstaler/GroupForm.cs 2007-04-30 08:01:48 UTC (rev 357)
+++ trunk/plugins/mpinstaler/MPInstaler/GroupForm.cs 2007-04-30 12:39:13 UTC (rev 358)
@@ -10,6 +10,7 @@
{
public partial class GroupForm : Form
{
+ public MPinstalerStruct _struct;
public GroupForm()
{
InitializeComponent();
@@ -17,7 +18,118 @@
private void button1_Click(object sender, EventArgs e)
{
+ _struct.SetupGroups.Clear();
+ for (int i = 0; i < listView1.Items.Count; i++)
+ {
+ _struct.SetupGroups.Add(new GroupString(listView1.Items[i].SubItems[0].Text, listView1.Items[i].SubItems[1].Text));
+ }
this.Close();
}
+
+ private void button4_Click(object sender, EventArgs e)
+ {
+ update_listview1(textBox1.Text, textBox2.Text);
+ }
+
+ private void update_listview1(string wid, string wval)
+ {
+ for (int i = 0; i < listView1.Items.Count; i++)
+ {
+ if (wid == listView1.Items[i].SubItems[0].Text)
+ {
+ listView1.Items.RemoveAt(i);
+ break;
+ }
+ }
+ ListViewItem item1 = new ListViewItem(wid, 0);
+ item1.SubItems.Add(wval);
+ listView1.Items.AddRange(new ListViewItem[] { item1 });
+ listView1.Sort();
+ }
+
+ private void listView1_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (listView1.SelectedItems.Count > 0)
+ {
+ textBox1.Text = listView1.SelectedItems[0].SubItems[0].Text;
+ textBox2.Text = listView1.SelectedItems[0].SubItems[1].Text;
+ }
+ }
+
+ private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ if (listView1.SelectedItems.Count > 0)
+ {
+ textBox1.Text = listView1.SelectedItems[0].SubItems[0].Text;
+ textBox2.Text = listView1.SelectedItems[0].SubItems[1].Text;
+ listView1.Items.Remove(listView1.SelectedItems[0]);
+ }
+
+ }
+
+ private void GroupForm_Load(object sender, EventArgs e)
+ {
+ listView1.Items.Clear();
+ foreach (GroupString gs in _struct.SetupGroups)
+ {
+ update_listview1(gs.Id, gs.Name);
+ }
+ }
+
+ private void tabPage2_Enter(object sender, EventArgs e)
+ {
+ comboBox1.Items.Clear();
+ for (int i = 0; i < listView1.Items.Count; i++)
+ {
+ comboBox1.Items.Add(listView1.Items[i].SubItems[0].Text);
+ }
+ }
+
+ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ listView2.Items.Clear();
+ listView3.Items.Clear();
+ foreach (MPIFileList fl in _struct.FileList)
+ {
+ if (_struct.FindFileInGroup(comboBox1.Text, fl.FileNameShort))
+ listView3.Items.Add(fl.FileNameShort);
+ else
+ listView2.Items.Add(fl.FileNameShort);
+ }
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+ for (int i=0; i < listView2.SelectedItems.Count; i++)
+ {
+ listView3.Items.Add(listView2.SelectedItems[i].Text);
+ listView2.Items.Remove(listView2.SelectedItems[i]);
+ }
+ update_data();
+ }
+
+ private void button3_Click(object sender, EventArgs e)
+ {
+ for (int i = 0; i < listView3.SelectedItems.Count; i++)
+ {
+ listView2.Items.Add(listView3.SelectedItems[i].Text);
+ listView3.Items.Remove(listView3.SelectedItems[i]);
+ }
+ update_data();
+ }
+
+ private void update_data()
+ {
+ for (int i = 0; i < _struct.SetupGroupsMappig.Count; i++)
+ {
+ if (_struct.SetupGroupsMappig[i].Id==comboBox1.Text)
+ _struct.SetupGroupsMappig.RemoveAt(i);
+ }
+
+ for (int i = 0; i < listView3.Items.Count; i++)
+ {
+ _struct.SetupGroupsMappig.Add(new GroupStringMapping(comboBox1.Text, listView3.Items[i].Text));
+ }
+ }
}
}
\ No newline at end of file
Modified: trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs
===================================================================
--- trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs 2007-04-30 08:01:48 UTC (rev 357)
+++ trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs 2007-04-30 12:39:13 UTC (rev 358)
@@ -50,13 +50,18 @@
public ArrayList FileList = new ArrayList();
public List<LanguageString> Language;
public List<ActionInfo> Actions;
-
+ public List<GroupString> SetupGroups;
+ public List<GroupStringMapping> SetupGroupsMappig;
+
public MPinstalerStruct()
{
Language = new List<LanguageString>();
Actions = new List<ActionInfo>();
ProiectProperties = new ProiectPropertiesClass();
+ SetupGroups = new List<GroupString>();
+ SetupGroupsMappig = new List<GroupStringMapping>();
}
+
public string UpdateURL
{
get { return _update; }
@@ -159,12 +164,36 @@
Actions.Add(a);
}
}
+
+ public void AddSetupGroupMapping(GroupStringMapping a)
+ {
+ int idx = -1;
+ for (int i = 0; i < SetupGroupsMappig.Count; i++)
+ {
+ if (SetupGroupsMappig[i].Id==a.Id && SetupGroupsMappig[i].FileName==a.FileName)
+ {
+ idx = i;
+ break;
+ }
+ }
+ if (idx > -1)
+ {
+ SetupGroupsMappig[idx].Id = a.Id;
+ SetupGroupsMappig[idx].FileName = a.FileName;
+ }
+ else
+ {
+ SetupGroupsMappig.Add(a);
+ }
+ }
public void Clear()
{
FileList.Clear();
Language.Clear();
Actions.Clear();
+ SetupGroups.Clear();
+ SetupGroupsMappig.Clear();
ProiectProperties.Clear();
BuildFileName = string.Empty;
ProiectdFileName = string.Empty;
@@ -232,6 +261,24 @@
writer.WriteEndElement();
}
writer.WriteEndElement();
+ writer.WriteStartElement("SetupGroups");
+ foreach (GroupString gs in SetupGroups)
+ {
+ writer.WriteStartElement("SetupGroup");
+ writer.WriteAttributeString("Id", gs.Id);
+ writer.WriteAttributeString("Name", gs.Name);
+ writer.WriteEndElement();
+ }
+ writer.WriteEndElement();
+ writer.WriteStartElement("SetupGroupMappings");
+ foreach (GroupStringMapping gs in SetupGroupsMappig)
+ {
+ writer.WriteStartElement("SetupGroupMapping");
+ writer.WriteAttributeString("Id", gs.Id);
+ writer.WriteAttributeString("FileName", gs.FileName);
+ writer.WriteEndElement();
+ }
+ writer.WriteEndElement();
writer.WriteStartElement("Option");
writer.WriteElementString("BuildFileName", this.BuildFileName);
writer.WriteElementString("ProiectFileName", Path.GetFullPath(this.ProiectdFileName));
@@ -360,6 +407,18 @@
Convert.ToInt32(actionnode.Attributes["Id"].Value),
actionnode.Attributes["Command"].Value));
}
+ XmlNodeList groupList = ver.SelectNodes("SetupGroups/SetupGroup");
+ foreach (XmlNode groupnode in groupList)
+ {
+ SetupGroups.Add(new GroupString(groupnode.Attributes["Id"].Value,
+ groupnode.Attributes["Name"].Value));
+ }
+ XmlNodeList groupmapList = ver.SelectNodes("SetupGroupMappings/SetupGroupMapping");
+ foreach (XmlNode groupnode in groupmapList)
+ {
+ SetupGroupsMappig.Add(new GroupStringMapping(groupnode.Attributes["Id"].Value,
+ groupnode.Attributes["FileName"].Value));
+ }
XmlNode nodeoption = ver.SelectSingleNode("Option");
this.BuildFileName = nodeoption.SelectSingleNode("BuildFileName").InnerText;
this.Name = nodeoption.SelectSingleNode("ProiectName").InnerText;
@@ -421,9 +480,22 @@
}
return fs;
}
+
+ public bool FindFileInGroup(string group,string file)
+ {
- public string GetZipEntry(MPIFileList flst)
+ for (int i = 0; i < SetupGroupsMappig.Count; i++)
{
+ if (SetupGroupsMappig[i].FileName==file && SetupGroupsMappig[i].Id==group)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public string GetZipEntry(MPIFileList flst)
+ {
string ret = string.Empty;
if (flst.Type == PLUGIN_TYPE)
{
@@ -814,4 +886,48 @@
return x_ret;
}
}
+
+ public class GroupString
+ {
+ string _id;
+ string _name;
+ public GroupString(string wid,string wname)
+ {
+ Id = wid;
+ Name = wname;
+ }
+ public string Id
+ {
+ get { return _id; }
+ set { _id = value; }
+ }
+ public string Name
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ }
+
+ public class GroupStringMapping
+ {
+ string _id;
+ string _filename;
+ public GroupStringMapping(string wid, string wname)
+ {
+ Id = wid;
+ FileName = wname;
+ }
+ public string Id
+ {
+ get { return _id; }
+ set { _id = value; }
+ }
+ public string FileName
+ {
+ get { return _filename; }
+ set { _filename = value; }
+ }
+
+ }
}
Modified: trunk/plugins/mpinstaler/MPInstaler/properties.cs
===================================================================
--- trunk/plugins/mpinstaler/MPInstaler/properties.cs 2007-04-30 08:01:48 UTC (rev 357)
+++ trunk/plugins/mpinstaler/MPInstaler/properties.cs 2007-04-30 12:39:13 UTC (rev 358)
@@ -13,6 +13,7 @@
private string forumurl;
private string weburl;
private DateTime creationdate;
+ private bool singlegroupselect;
public ProiectPropertiesClass()
{
@@ -79,13 +80,25 @@
}
}
+ public bool SingleGroupSelect
+ {
+ set
+ {
+ singlegroupselect = value;
+ }
+ get
+ {
+ return singlegroupselect;
+ }
+ }
public void Save(XmlWriter writer)
{
writer.WriteElementString("MPMaxVersion", MPMaxVersion);
writer.WriteElementString("MPMinVersion", MPMinVersion);
writer.WriteElementString("ForumURL", ForumURL);
writer.WriteElementString("WebURL", WebURL);
- writer.WriteElementString("CreationDate", CreationDate.ToString("F", new CultureInfo("en-US")));
+ writer.WriteElementString("CreationDate", CreationDate.ToString("F", new CultureInfo("en-US")));
+ writer.WriteElementString("SingleGroupSelect", SingleGroupSelect.ToString());
}
public void Load(XmlNode basenode)
@@ -108,6 +121,11 @@
node = basenode.SelectSingleNode("CreationDate");
if (node != null && node.InnerText != null)
DateTime.TryParse(node.InnerText,out creationdate);
+ node = basenode.SelectSingleNode("SingleGroupSelect");
+ if (node != null && node.InnerText != null)
+ if (node.InnerText == "True")
+ SingleGroupSelect = true;
+ else SingleGroupSelect = false;
}
@@ -119,7 +137,8 @@
MPMinVersion = String.Empty;
ForumURL = String.Empty;
WebURL = String.Empty;
- CreationDate = DateTime.Today;
+ CreationDate = DateTime.Today;
+ SingleGroupSelect = false;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|