populate the general page in the settings dialog

svn path=/trunk/tools/RosTE/; revision=253
This commit is contained in:
Ged Murphy 2007-06-26 10:17:37 +00:00
parent 49e78b7143
commit 6bb4c71ab1
7 changed files with 616 additions and 562 deletions

View File

@ -68,9 +68,8 @@ namespace RosTEGUI
private void ImageListView_DoubleClick(object sender, EventArgs e)
{
ListViewItem lvi = VirtMachListView.FocusedItem;
//lvi.Tag
SettingsForm setFrm = new SettingsForm(lvi.Text);
SettingsForm setFrm = new SettingsForm(lvi.Tag);
setFrm.StartPosition = FormStartPosition.CenterScreen;
setFrm.Show();
}

View File

@ -36,6 +36,8 @@ namespace RosTEGUI
this.tabPage1 = new System.Windows.Forms.TabPage();
this.memoryPanel = new System.Windows.Forms.Panel();
this.memoryGrpBox = new System.Windows.Forms.GroupBox();
this.memoryHorizRuleLight = new System.Windows.Forms.Panel();
this.memoryHorizRuleDark = new System.Windows.Forms.Panel();
this.memoryPhyRam = new System.Windows.Forms.Label();
this.memoryLabel2 = new System.Windows.Forms.Label();
this.memoryGrpBox1 = new System.Windows.Forms.GroupBox();
@ -117,12 +119,14 @@ namespace RosTEGUI
this.settingsHelpBtn = new System.Windows.Forms.Button();
this.settingsTab = new System.Windows.Forms.TabControl();
this.settingsHardwareTab = new System.Windows.Forms.TabPage();
this.hardwareSelLstBox = new RosTEGUI.OptListBox();
this.settingsOptionsTab = new System.Windows.Forms.TabPage();
this.optionsContainerPanel = new System.Windows.Forms.Panel();
this.optionsTempDesignSheetTab = new System.Windows.Forms.TabControl();
this.tabPage8 = new System.Windows.Forms.TabPage();
this.generalPanel = new System.Windows.Forms.Panel();
this.generalGrpBox = new System.Windows.Forms.GroupBox();
this.generalEditbutton = new System.Windows.Forms.Button();
this.generalSetClockHost = new System.Windows.Forms.CheckBox();
this.generalWorkDirBrows = new System.Windows.Forms.Button();
this.generalWorkDir = new System.Windows.Forms.TextBox();
@ -143,11 +147,8 @@ namespace RosTEGUI
this.tabPage12 = new System.Windows.Forms.TabPage();
this.debugPanel = new System.Windows.Forms.Panel();
this.debugGrpBox = new System.Windows.Forms.GroupBox();
this.browseDlg = new System.Windows.Forms.FolderBrowserDialog();
this.memoryHorizRuleDark = new System.Windows.Forms.Panel();
this.memoryHorizRuleLight = new System.Windows.Forms.Panel();
this.hardwareSelLstBox = new RosTEGUI.OptListBox();
this.optionsSelLstBox = new RosTEGUI.OptListBox();
this.browseDlg = new System.Windows.Forms.FolderBrowserDialog();
this.hardwareContainerPanel.SuspendLayout();
this.hardwareTempDesignSheetTab.SuspendLayout();
this.tabPage1.SuspendLayout();
@ -279,6 +280,22 @@ namespace RosTEGUI
this.memoryGrpBox.TabStop = false;
this.memoryGrpBox.Text = "Memory";
//
// memoryHorizRuleLight
//
this.memoryHorizRuleLight.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.memoryHorizRuleLight.Location = new System.Drawing.Point(9, 185);
this.memoryHorizRuleLight.Name = "memoryHorizRuleLight";
this.memoryHorizRuleLight.Size = new System.Drawing.Size(265, 1);
this.memoryHorizRuleLight.TabIndex = 16;
//
// memoryHorizRuleDark
//
this.memoryHorizRuleDark.BackColor = System.Drawing.SystemColors.ControlDark;
this.memoryHorizRuleDark.Location = new System.Drawing.Point(9, 184);
this.memoryHorizRuleDark.Name = "memoryHorizRuleDark";
this.memoryHorizRuleDark.Size = new System.Drawing.Size(265, 1);
this.memoryHorizRuleDark.TabIndex = 15;
//
// memoryPhyRam
//
this.memoryPhyRam.AutoSize = true;
@ -1075,6 +1092,20 @@ namespace RosTEGUI
this.settingsHardwareTab.Text = "Hardware";
this.settingsHardwareTab.UseVisualStyleBackColor = true;
//
// hardwareSelLstBox
//
this.hardwareSelLstBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.hardwareSelLstBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.hardwareSelLstBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.hardwareSelLstBox.FormattingEnabled = true;
this.hardwareSelLstBox.ImageList = this.optListBoxImgLst;
this.hardwareSelLstBox.Location = new System.Drawing.Point(3, 6);
this.hardwareSelLstBox.Name = "hardwareSelLstBox";
this.hardwareSelLstBox.Size = new System.Drawing.Size(74, 340);
this.hardwareSelLstBox.TabIndex = 0;
this.hardwareSelLstBox.MouseEnter += new System.EventHandler(this.hardwareSelLstBox_MouseEnter);
this.hardwareSelLstBox.SelectedIndexChanged += new System.EventHandler(this.listboxSelection_SelectedIndexChanged);
//
// settingsOptionsTab
//
this.settingsOptionsTab.Controls.Add(this.optionsContainerPanel);
@ -1127,9 +1158,11 @@ namespace RosTEGUI
this.generalPanel.Name = "generalPanel";
this.generalPanel.Size = new System.Drawing.Size(280, 361);
this.generalPanel.TabIndex = 0;
this.generalPanel.Layout += new System.Windows.Forms.LayoutEventHandler(this.generalPanel_Layout);
//
// generalGrpBox
//
this.generalGrpBox.Controls.Add(this.generalEditbutton);
this.generalGrpBox.Controls.Add(this.generalSetClockHost);
this.generalGrpBox.Controls.Add(this.generalWorkDirBrows);
this.generalGrpBox.Controls.Add(this.generalWorkDir);
@ -1145,10 +1178,20 @@ namespace RosTEGUI
this.generalGrpBox.TabStop = false;
this.generalGrpBox.Text = "General";
//
// generalEditbutton
//
this.generalEditbutton.Location = new System.Drawing.Point(6, 118);
this.generalEditbutton.Name = "generalEditbutton";
this.generalEditbutton.Size = new System.Drawing.Size(75, 23);
this.generalEditbutton.TabIndex = 8;
this.generalEditbutton.Text = "Edit";
this.generalEditbutton.UseVisualStyleBackColor = true;
this.generalEditbutton.Click += new System.EventHandler(this.generalEditbutton_Click);
//
// generalSetClockHost
//
this.generalSetClockHost.AutoSize = true;
this.generalSetClockHost.Location = new System.Drawing.Point(17, 201);
this.generalSetClockHost.Location = new System.Drawing.Point(6, 203);
this.generalSetClockHost.Name = "generalSetClockHost";
this.generalSetClockHost.Size = new System.Drawing.Size(128, 17);
this.generalSetClockHost.TabIndex = 7;
@ -1157,7 +1200,8 @@ namespace RosTEGUI
//
// generalWorkDirBrows
//
this.generalWorkDirBrows.Location = new System.Drawing.Point(199, 148);
this.generalWorkDirBrows.Enabled = false;
this.generalWorkDirBrows.Location = new System.Drawing.Point(199, 118);
this.generalWorkDirBrows.Name = "generalWorkDirBrows";
this.generalWorkDirBrows.Size = new System.Drawing.Size(75, 23);
this.generalWorkDirBrows.TabIndex = 6;
@ -1166,15 +1210,16 @@ namespace RosTEGUI
//
// generalWorkDir
//
this.generalWorkDir.Location = new System.Drawing.Point(9, 150);
this.generalWorkDir.Location = new System.Drawing.Point(6, 92);
this.generalWorkDir.Name = "generalWorkDir";
this.generalWorkDir.Size = new System.Drawing.Size(184, 20);
this.generalWorkDir.ReadOnly = true;
this.generalWorkDir.Size = new System.Drawing.Size(268, 20);
this.generalWorkDir.TabIndex = 5;
//
// generalLabel3
//
this.generalLabel3.AutoSize = true;
this.generalLabel3.Location = new System.Drawing.Point(3, 134);
this.generalLabel3.Location = new System.Drawing.Point(3, 76);
this.generalLabel3.Name = "generalLabel3";
this.generalLabel3.Size = new System.Drawing.Size(90, 13);
this.generalLabel3.TabIndex = 4;
@ -1186,15 +1231,15 @@ namespace RosTEGUI
this.generalMachine.Items.AddRange(new object[] {
"Standard PC (default)",
"ISA-only PC"});
this.generalMachine.Location = new System.Drawing.Point(6, 93);
this.generalMachine.Location = new System.Drawing.Point(6, 165);
this.generalMachine.Name = "generalMachine";
this.generalMachine.Size = new System.Drawing.Size(268, 21);
this.generalMachine.Size = new System.Drawing.Size(265, 21);
this.generalMachine.TabIndex = 3;
//
// generalLabel2
//
this.generalLabel2.AutoSize = true;
this.generalLabel2.Location = new System.Drawing.Point(3, 77);
this.generalLabel2.Location = new System.Drawing.Point(6, 149);
this.generalLabel2.Name = "generalLabel2";
this.generalLabel2.Size = new System.Drawing.Size(48, 13);
this.generalLabel2.TabIndex = 2;
@ -1213,6 +1258,7 @@ namespace RosTEGUI
//
this.generalVMName.Location = new System.Drawing.Point(6, 42);
this.generalVMName.Name = "generalVMName";
this.generalVMName.ReadOnly = true;
this.generalVMName.Size = new System.Drawing.Size(268, 20);
this.generalVMName.TabIndex = 0;
//
@ -1332,36 +1378,6 @@ namespace RosTEGUI
this.debugGrpBox.TabStop = false;
this.debugGrpBox.Text = "Debug";
//
// memoryHorizRuleDark
//
this.memoryHorizRuleDark.BackColor = System.Drawing.SystemColors.ControlDark;
this.memoryHorizRuleDark.Location = new System.Drawing.Point(9, 184);
this.memoryHorizRuleDark.Name = "memoryHorizRuleDark";
this.memoryHorizRuleDark.Size = new System.Drawing.Size(265, 1);
this.memoryHorizRuleDark.TabIndex = 15;
//
// memoryHorizRuleLight
//
this.memoryHorizRuleLight.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.memoryHorizRuleLight.Location = new System.Drawing.Point(9, 185);
this.memoryHorizRuleLight.Name = "memoryHorizRuleLight";
this.memoryHorizRuleLight.Size = new System.Drawing.Size(265, 1);
this.memoryHorizRuleLight.TabIndex = 16;
//
// hardwareSelLstBox
//
this.hardwareSelLstBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.hardwareSelLstBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.hardwareSelLstBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.hardwareSelLstBox.FormattingEnabled = true;
this.hardwareSelLstBox.ImageList = this.optListBoxImgLst;
this.hardwareSelLstBox.Location = new System.Drawing.Point(3, 6);
this.hardwareSelLstBox.Name = "hardwareSelLstBox";
this.hardwareSelLstBox.Size = new System.Drawing.Size(74, 340);
this.hardwareSelLstBox.TabIndex = 0;
this.hardwareSelLstBox.MouseEnter += new System.EventHandler(this.hardwareSelLstBox_MouseEnter);
this.hardwareSelLstBox.SelectedIndexChanged += new System.EventHandler(this.listboxSelection_SelectedIndexChanged);
//
// optionsSelLstBox
//
this.optionsSelLstBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@ -1570,5 +1586,6 @@ namespace RosTEGUI
private System.Windows.Forms.GroupBox debugGrpBox;
private System.Windows.Forms.Panel memoryHorizRuleDark;
private System.Windows.Forms.Panel memoryHorizRuleLight;
private System.Windows.Forms.Button generalEditbutton;
}
}

View File

@ -13,15 +13,18 @@ namespace RosTEGUI
{
public partial class SettingsForm : Form
{
private VirtualMachine VirtMach;
private Panel[] hardwarePanels;
private Panel[] optionsPanels;
private int hardwarePrevSel = 0;
private int optionsPrevSel = 0;
public SettingsForm(string title)
public SettingsForm(object sender)
{
InitializeComponent();
Text = title + " " + Text;
VirtMach = (VirtualMachine)sender;
Text = VirtMach.Name + " " + Text;
}
private void LoadDynamicControlInfo()
@ -172,5 +175,26 @@ namespace RosTEGUI
floppyConnGrpBox.Enabled = bEnabled;
}
private void generalPanel_Layout(object sender, LayoutEventArgs e)
{
generalVMName.Text = VirtMach.Name;
generalWorkDir.Text = VirtMach.DefDir;
if (VirtMach.MachType == "pc")
generalMachine.SelectedIndex = 0;
else
generalMachine.SelectedIndex = 1;
generalSetClockHost.Checked = VirtMach.SetClockToHost;
}
private void generalEditbutton_Click(object sender, EventArgs e)
{
generalVMName.ReadOnly = false;
generalWorkDir.ReadOnly = false;
generalWorkDirBrows.Enabled = true;
generalEditbutton.Enabled = false;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
<xs:element name="DefDir" type="xs:string" />
<xs:element name="MemSize" type="xs:int" />
<xs:element name="CdRomEnable" type="xs:boolean" />
<xs:element name="SetClockToHost" type="xs:boolean" />
<xs:element name="CdRomUsePhys" type="xs:boolean" />
<xs:element name="CdRomPhyDrv" type="xs:string" />
<xs:element name="CdRomUseIso" type="xs:boolean" />

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
<XSDDesignerLayout Style="LeftRight" layoutVersion="2" viewPortLeft="844" viewPortTop="-4677" zoom="100">
<XSDDesignerLayout Style="LeftRight" layoutVersion="2" viewPortLeft="-128" viewPortTop="-6097" zoom="100">
<VMConfig_XmlElement left="7091" top="-3148" width="7858" height="11721" selected="0" zOrder="0" index="0" expanded="1" />
<HardDisks_XmlElement left="872" top="-3201" width="5292" height="2831" selected="0" zOrder="2" index="1" expanded="1" />
<HardDisks_XmlElement left="872" top="-3201" width="5292" height="2831" selected="0" zOrder="3" index="1" expanded="1" />
<NetCards_XmlElement left="16033" top="-3176" width="5292" height="5371" selected="0" zOrder="1" index="2" expanded="1" />
<VMConfigNetCards_XmlKeyref left="14491" top="-4687" width="503" height="503" selected="0" zOrder="7" expanded="0" />
<VMConfigHardDisks_XmlKeyref left="5763" top="-4794" width="503" height="503" selected="0" zOrder="3" expanded="0" />
<VMConfigNetCards_XmlKeyref left="14174" top="-4941" width="503" height="503" selected="0" zOrder="8" expanded="0" />
<VMConfigHardDisks_XmlKeyref left="5446" top="-5048" width="503" height="503" selected="0" zOrder="4" expanded="0" />
</XSDDesignerLayout>

View File

@ -3,6 +3,7 @@ using System.IO;
using System.Collections.Specialized;
using System.Data;
using System.Xml;
using System.Windows.Forms;
namespace RosTEGUI
{
@ -42,6 +43,12 @@ namespace RosTEGUI
set { dataRow["MemSize"] = value; }
}
public bool SetClockToHost
{
get { return (bool)dataRow["SetClockToHost"]; }
set { dataRow["SetClockToHost"] = value; }
}
public bool CdRomEnable
{
get { return (bool)dataRow["CdRomEnable"]; }
@ -117,13 +124,21 @@ namespace RosTEGUI
// default
public bool CreateVMConfig(string name)
{
return CreateVMConfig(name, "Images\\" + name, 0.2f, null, 256);
return CreateVMConfig(name,
Directory.GetCurrentDirectory() + "\\Images\\" + name,
0.2f,
"",
256);
}
// existing
public bool CreateVMConfig(string name, string existImg, int memSize)
{
return CreateVMConfig(name, null, 0.0f, existImg, memSize);
return CreateVMConfig(name,
null,
0.0f,
existImg,
memSize);
}
// new
@ -135,7 +150,7 @@ namespace RosTEGUI
{
bool ret = false;
if (existImg != null)
if (existImg != "")
{
DirectoryInfo di = Directory.GetParent(existImg);
dir = di.FullName;
@ -146,9 +161,10 @@ namespace RosTEGUI
dataRow = dt.NewRow();
dataRow["VirtMachID"] = i;
dataRow["Name"] = name;
dataRow["MachType"] = "test";
dataRow["MachType"] = "pc";
dataRow["DefDir"] = dir;
dataRow["MemSize"] = memSize;
dataRow["SetClockToHost"] = true;
dataRow["CdRomEnable"] = true;
dataRow["CdRomUsePhys"] = false;
dataRow["CdRomPhyDrv"] = "R:";
@ -162,8 +178,6 @@ namespace RosTEGUI
dt.Rows.Add(dataRow);
Name = name;
return ret;
}
@ -174,15 +188,22 @@ namespace RosTEGUI
if (File.Exists(fileName))
{
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
XmlTextReader xtr = new XmlTextReader(fs);
data.DataSet.ReadXml(xtr, System.Data.XmlReadMode.ReadSchema);
xtr.Close();
try
{
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
XmlTextReader xtr = new XmlTextReader(fs);
data.DataSet.ReadXml(xtr, System.Data.XmlReadMode.ReadSchema);
xtr.Close();
DataTable dt = data.DataSet.Tables["VMConfig"];
dataRow = dt.Rows[0];
DataTable dt = data.DataSet.Tables["VMConfig"];
dataRow = dt.Rows[0];
ret = true;
ret = true;
}
catch (Exception e)
{
MessageBox.Show("error loading VM Config.xml: " + e.Message);
}
}
return ret;