Cleaned the Settings.cs and added some responsiveness

This commit is contained in:
2023-05-22 14:00:15 +02:00
parent 66906cb54e
commit af8db571f3
3 changed files with 271 additions and 289 deletions
+1
View File
@@ -33,6 +33,7 @@ namespace Test_Merge
} }
private async void btnSettings_Click(object sender, EventArgs e) private async void btnSettings_Click(object sender, EventArgs e)
{ {
if(Emulator != null)
Emulator.Stop(); Emulator.Stop();
Settings settingsForm = new Settings(); Settings settingsForm = new Settings();
settingsForm.ShowDialog(); settingsForm.ShowDialog();
+211 -249
View File
@@ -30,52 +30,48 @@
{ {
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.gpbxInfos = new System.Windows.Forms.GroupBox(); this.gpbxRaceSettings = new System.Windows.Forms.GroupBox();
this.tbxGpYear = new System.Windows.Forms.TextBox();
this.tbxGpName = new System.Windows.Forms.TextBox();
this.tbxGpUrl = new System.Windows.Forms.TextBox(); this.tbxGpUrl = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.gpbxDriverList = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lsbDrivers = new System.Windows.Forms.ListBox(); this.lsbDrivers = new System.Windows.Forms.ListBox();
this.btnRemoveDriver = new System.Windows.Forms.Button(); this.btnRemoveDriver = new System.Windows.Forms.Button();
this.btnAddDriver = new System.Windows.Forms.Button(); this.btnAddDriver = new System.Windows.Forms.Button();
this.tbxDriverName = new System.Windows.Forms.TextBox(); this.tbxDriverName = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.gpbxPreview = new System.Windows.Forms.GroupBox();
this.lblWindowsRemaining = new System.Windows.Forms.Label();
this.btnResetDriver = new System.Windows.Forms.Button(); this.btnResetDriver = new System.Windows.Forms.Button();
this.btnRefresh = new System.Windows.Forms.Button(); this.btnRefresh = new System.Windows.Forms.Button();
this.pbxMain = new System.Windows.Forms.PictureBox(); this.lblWindowPointsRemaining = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.lblZonePointsRemaning = new System.Windows.Forms.Label();
this.pbxDriverZone = new System.Windows.Forms.PictureBox(); this.btnCreateWindow = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.pbxPreview = new System.Windows.Forms.PictureBox();
this.btnCreatZone = new System.Windows.Forms.Button();
this.gpbxWindowPreview = new System.Windows.Forms.GroupBox();
this.pbxWindowPreview = new System.Windows.Forms.PictureBox();
this.btnLoadPreset = new System.Windows.Forms.Button(); this.btnLoadPreset = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label();
this.lsbPresets = new System.Windows.Forms.ListBox(); this.lsbPresets = new System.Windows.Forms.ListBox();
this.tbxPresetName = new System.Windows.Forms.TextBox(); this.tbxPresetName = new System.Windows.Forms.TextBox();
this.btnSavePreset = new System.Windows.Forms.Button(); this.btnSavePreset = new System.Windows.Forms.Button();
this.lblWindowsRemaining = new System.Windows.Forms.Label(); this.gpbxPresets = new System.Windows.Forms.GroupBox();
this.lblZonePointsRemaning = new System.Windows.Forms.Label(); this.btnDeletePreset = new System.Windows.Forms.Button();
this.lblWindowPointsRemaining = new System.Windows.Forms.Label(); this.gpbxRaceSettings.SuspendLayout();
this.btnCreateWindow = new System.Windows.Forms.Button(); this.gpbxDriverList.SuspendLayout();
this.btnCreatZone = new System.Windows.Forms.Button(); this.gpbxPreview.SuspendLayout();
this.gpbxInfos.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbxPreview)).BeginInit();
this.groupBox1.SuspendLayout(); this.gpbxWindowPreview.SuspendLayout();
this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbxWindowPreview)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbxMain)).BeginInit(); this.gpbxPresets.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxDriverZone)).BeginInit();
this.groupBox4.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(593, 16); this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(132, 36); this.label1.Size = new System.Drawing.Size(260, 36);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "Setttings"; this.label1.Text = "Configuration tool";
// //
// label2 // label2
// //
@@ -87,96 +83,57 @@
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
this.label2.Text = "Grand Prix URL"; this.label2.Text = "Grand Prix URL";
// //
// gpbxInfos // gpbxRaceSettings
// //
this.gpbxInfos.Controls.Add(this.tbxGpYear); this.gpbxRaceSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.gpbxInfos.Controls.Add(this.tbxGpName); this.gpbxRaceSettings.Controls.Add(this.tbxGpUrl);
this.gpbxInfos.Controls.Add(this.tbxGpUrl); this.gpbxRaceSettings.Controls.Add(this.label2);
this.gpbxInfos.Controls.Add(this.label4); this.gpbxRaceSettings.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbxInfos.Controls.Add(this.label3); this.gpbxRaceSettings.Location = new System.Drawing.Point(715, 2);
this.gpbxInfos.Controls.Add(this.label2); this.gpbxRaceSettings.Name = "gpbxRaceSettings";
this.gpbxInfos.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbxRaceSettings.Size = new System.Drawing.Size(521, 70);
this.gpbxInfos.Location = new System.Drawing.Point(18, 55); this.gpbxRaceSettings.TabIndex = 2;
this.gpbxInfos.Name = "gpbxInfos"; this.gpbxRaceSettings.TabStop = false;
this.gpbxInfos.Size = new System.Drawing.Size(259, 226); this.gpbxRaceSettings.Text = "RaceSettings";
this.gpbxInfos.TabIndex = 2;
this.gpbxInfos.TabStop = false;
this.gpbxInfos.Text = "RaceSettings";
//
// tbxGpYear
//
this.tbxGpYear.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxGpYear.Location = new System.Drawing.Point(6, 187);
this.tbxGpYear.Name = "tbxGpYear";
this.tbxGpYear.Size = new System.Drawing.Size(247, 29);
this.tbxGpYear.TabIndex = 6;
this.tbxGpYear.TextChanged += new System.EventHandler(this.tbxGpYear_TextChanged);
//
// tbxGpName
//
this.tbxGpName.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxGpName.Location = new System.Drawing.Point(6, 117);
this.tbxGpName.Name = "tbxGpName";
this.tbxGpName.Size = new System.Drawing.Size(247, 29);
this.tbxGpName.TabIndex = 5;
this.tbxGpName.TextChanged += new System.EventHandler(this.tbxGpName_TextChanged);
// //
// tbxGpUrl // tbxGpUrl
// //
this.tbxGpUrl.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tbxGpUrl.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxGpUrl.Location = new System.Drawing.Point(6, 53); this.tbxGpUrl.Location = new System.Drawing.Point(144, 24);
this.tbxGpUrl.Name = "tbxGpUrl"; this.tbxGpUrl.Name = "tbxGpUrl";
this.tbxGpUrl.Size = new System.Drawing.Size(247, 29); this.tbxGpUrl.Size = new System.Drawing.Size(367, 29);
this.tbxGpUrl.TabIndex = 4; this.tbxGpUrl.TabIndex = 4;
this.tbxGpUrl.TextChanged += new System.EventHandler(this.tbxGpUrl_TextChanged); this.tbxGpUrl.TextChanged += new System.EventHandler(this.tbxGpUrl_TextChanged);
// //
// label4 // gpbxDriverList
// //
this.label4.AutoSize = true; this.gpbxDriverList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbxDriverList.Controls.Add(this.lsbDrivers);
this.label4.Location = new System.Drawing.Point(6, 161); this.gpbxDriverList.Controls.Add(this.btnRemoveDriver);
this.label4.Name = "label4"; this.gpbxDriverList.Controls.Add(this.btnAddDriver);
this.label4.Size = new System.Drawing.Size(45, 23); this.gpbxDriverList.Controls.Add(this.tbxDriverName);
this.label4.TabIndex = 3; this.gpbxDriverList.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.label4.Text = "Year"; this.gpbxDriverList.Location = new System.Drawing.Point(976, 55);
// this.gpbxDriverList.Name = "gpbxDriverList";
// label3 this.gpbxDriverList.Size = new System.Drawing.Size(259, 269);
// this.gpbxDriverList.TabIndex = 3;
this.label3.AutoSize = true; this.gpbxDriverList.TabStop = false;
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gpbxDriverList.Text = "DriverList";
this.label3.Location = new System.Drawing.Point(6, 91);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 23);
this.label3.TabIndex = 2;
this.label3.Text = "Name";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.lsbDrivers);
this.groupBox1.Controls.Add(this.btnRemoveDriver);
this.groupBox1.Controls.Add(this.btnAddDriver);
this.groupBox1.Controls.Add(this.tbxDriverName);
this.groupBox1.Location = new System.Drawing.Point(18, 287);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(259, 376);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DriverList";
// //
// lsbDrivers // lsbDrivers
// //
this.lsbDrivers.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); this.lsbDrivers.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.lsbDrivers.FormattingEnabled = true; this.lsbDrivers.FormattingEnabled = true;
this.lsbDrivers.ItemHeight = 23; this.lsbDrivers.ItemHeight = 23;
this.lsbDrivers.Location = new System.Drawing.Point(10, 109); this.lsbDrivers.Location = new System.Drawing.Point(10, 23);
this.lsbDrivers.Name = "lsbDrivers"; this.lsbDrivers.Name = "lsbDrivers";
this.lsbDrivers.Size = new System.Drawing.Size(243, 257); this.lsbDrivers.Size = new System.Drawing.Size(243, 142);
this.lsbDrivers.TabIndex = 10; this.lsbDrivers.TabIndex = 10;
// //
// btnRemoveDriver // btnRemoveDriver
// //
this.btnRemoveDriver.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnRemoveDriver.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnRemoveDriver.Location = new System.Drawing.Point(132, 24); this.btnRemoveDriver.Location = new System.Drawing.Point(132, 175);
this.btnRemoveDriver.Name = "btnRemoveDriver"; this.btnRemoveDriver.Name = "btnRemoveDriver";
this.btnRemoveDriver.Size = new System.Drawing.Size(121, 44); this.btnRemoveDriver.Size = new System.Drawing.Size(121, 44);
this.btnRemoveDriver.TabIndex = 9; this.btnRemoveDriver.TabIndex = 9;
@@ -187,7 +144,7 @@
// btnAddDriver // btnAddDriver
// //
this.btnAddDriver.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnAddDriver.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAddDriver.Location = new System.Drawing.Point(10, 24); this.btnAddDriver.Location = new System.Drawing.Point(10, 175);
this.btnAddDriver.Name = "btnAddDriver"; this.btnAddDriver.Name = "btnAddDriver";
this.btnAddDriver.Size = new System.Drawing.Size(116, 44); this.btnAddDriver.Size = new System.Drawing.Size(116, 44);
this.btnAddDriver.TabIndex = 8; this.btnAddDriver.TabIndex = 8;
@@ -198,218 +155,227 @@
// tbxDriverName // tbxDriverName
// //
this.tbxDriverName.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tbxDriverName.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxDriverName.Location = new System.Drawing.Point(10, 74); this.tbxDriverName.Location = new System.Drawing.Point(10, 225);
this.tbxDriverName.Name = "tbxDriverName"; this.tbxDriverName.Name = "tbxDriverName";
this.tbxDriverName.Size = new System.Drawing.Size(243, 29); this.tbxDriverName.Size = new System.Drawing.Size(243, 29);
this.tbxDriverName.TabIndex = 7; this.tbxDriverName.TabIndex = 7;
// //
// groupBox2 // gpbxPreview
// //
this.groupBox2.Controls.Add(this.btnResetDriver); this.gpbxPreview.Controls.Add(this.lblWindowsRemaining);
this.groupBox2.Controls.Add(this.btnRefresh); this.gpbxPreview.Controls.Add(this.btnResetDriver);
this.groupBox2.Controls.Add(this.pbxMain); this.gpbxPreview.Controls.Add(this.btnRefresh);
this.groupBox2.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); this.gpbxPreview.Controls.Add(this.lblWindowPointsRemaining);
this.groupBox2.Location = new System.Drawing.Point(283, 55); this.gpbxPreview.Controls.Add(this.lblZonePointsRemaning);
this.groupBox2.Name = "groupBox2"; this.gpbxPreview.Controls.Add(this.btnCreateWindow);
this.groupBox2.Size = new System.Drawing.Size(968, 608); this.gpbxPreview.Controls.Add(this.pbxPreview);
this.groupBox2.TabIndex = 4; this.gpbxPreview.Controls.Add(this.btnCreatZone);
this.groupBox2.TabStop = false; this.gpbxPreview.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.groupBox2.Text = "Preview"; this.gpbxPreview.Location = new System.Drawing.Point(2, 55);
this.gpbxPreview.Name = "gpbxPreview";
this.gpbxPreview.Size = new System.Drawing.Size(968, 608);
this.gpbxPreview.TabIndex = 4;
this.gpbxPreview.TabStop = false;
this.gpbxPreview.Text = "Preview";
//
// lblWindowsRemaining
//
this.lblWindowsRemaining.AutoSize = true;
this.lblWindowsRemaining.Location = new System.Drawing.Point(218, 85);
this.lblWindowsRemaining.Name = "lblWindowsRemaining";
this.lblWindowsRemaining.Size = new System.Drawing.Size(183, 23);
this.lblWindowsRemaining.TabIndex = 6;
this.lblWindowsRemaining.Text = "7 windows remaining";
// //
// btnResetDriver // btnResetDriver
// //
this.btnResetDriver.Location = new System.Drawing.Point(855, 17); this.btnResetDriver.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnResetDriver.Location = new System.Drawing.Point(745, 23);
this.btnResetDriver.Name = "btnResetDriver"; this.btnResetDriver.Name = "btnResetDriver";
this.btnResetDriver.Size = new System.Drawing.Size(101, 33); this.btnResetDriver.Size = new System.Drawing.Size(211, 33);
this.btnResetDriver.TabIndex = 2; this.btnResetDriver.TabIndex = 2;
this.btnResetDriver.Text = "Reset"; this.btnResetDriver.Text = "Reset the emulator";
this.btnResetDriver.UseVisualStyleBackColor = true; this.btnResetDriver.UseVisualStyleBackColor = true;
this.btnResetDriver.Click += new System.EventHandler(this.btnResetDriver_Click); this.btnResetDriver.Click += new System.EventHandler(this.btnResetDriver_Click);
// //
// btnRefresh // btnRefresh
// //
this.btnRefresh.Location = new System.Drawing.Point(6, 23); this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRefresh.Location = new System.Drawing.Point(546, 23);
this.btnRefresh.Name = "btnRefresh"; this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(101, 33); this.btnRefresh.Size = new System.Drawing.Size(193, 33);
this.btnRefresh.TabIndex = 1; this.btnRefresh.TabIndex = 1;
this.btnRefresh.Text = "Refresh"; this.btnRefresh.Text = "Get a newer image";
this.btnRefresh.UseVisualStyleBackColor = true; this.btnRefresh.UseVisualStyleBackColor = true;
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
// //
// pbxMain // lblWindowPointsRemaining
// //
this.pbxMain.Location = new System.Drawing.Point(6, 62); this.lblWindowPointsRemaining.AutoSize = true;
this.pbxMain.Name = "pbxMain"; this.lblWindowPointsRemaining.Location = new System.Drawing.Point(218, 62);
this.pbxMain.Size = new System.Drawing.Size(950, 535); this.lblWindowPointsRemaining.Name = "lblWindowPointsRemaining";
this.pbxMain.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.lblWindowPointsRemaining.Size = new System.Drawing.Size(163, 23);
this.pbxMain.TabIndex = 0; this.lblWindowPointsRemaining.TabIndex = 4;
this.pbxMain.TabStop = false; this.lblWindowPointsRemaining.Text = "0 points remaining";
this.pbxMain.Click += new System.EventHandler(this.pbxMain_Click);
this.pbxMain.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxMain_MouseClick);
// //
// groupBox3 // lblZonePointsRemaning
// //
this.groupBox3.Controls.Add(this.pbxDriverZone); this.lblZonePointsRemaning.AutoSize = true;
this.groupBox3.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); this.lblZonePointsRemaning.Location = new System.Drawing.Point(22, 62);
this.groupBox3.Location = new System.Drawing.Point(18, 669); this.lblZonePointsRemaning.Name = "lblZonePointsRemaning";
this.groupBox3.Name = "groupBox3"; this.lblZonePointsRemaning.Size = new System.Drawing.Size(163, 23);
this.groupBox3.Size = new System.Drawing.Size(1452, 83); this.lblZonePointsRemaning.TabIndex = 5;
this.groupBox3.TabIndex = 5; this.lblZonePointsRemaning.Text = "0 points remaining";
this.groupBox3.TabStop = false;
this.groupBox3.Text = "DriverZonePreview";
// //
// pbxDriverZone // btnCreateWindow
// //
this.pbxDriverZone.Location = new System.Drawing.Point(10, 27); this.btnCreateWindow.Location = new System.Drawing.Point(213, 23);
this.pbxDriverZone.Name = "pbxDriverZone"; this.btnCreateWindow.Name = "btnCreateWindow";
this.pbxDriverZone.Size = new System.Drawing.Size(1436, 50); this.btnCreateWindow.Size = new System.Drawing.Size(201, 33);
this.pbxDriverZone.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.btnCreateWindow.TabIndex = 2;
this.pbxDriverZone.TabIndex = 0; this.btnCreateWindow.Text = "Create the windows";
this.pbxDriverZone.TabStop = false; this.btnCreateWindow.UseVisualStyleBackColor = true;
this.pbxDriverZone.Click += new System.EventHandler(this.pbxDriverZone_Click); this.btnCreateWindow.Click += new System.EventHandler(this.btnCreateWindow_Click);
this.pbxDriverZone.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxDriverZone_MouseClick);
// //
// groupBox4 // pbxPreview
// //
this.groupBox4.Controls.Add(this.btnLoadPreset); this.pbxPreview.Location = new System.Drawing.Point(10, 62);
this.groupBox4.Controls.Add(this.label8); this.pbxPreview.Name = "pbxPreview";
this.groupBox4.Controls.Add(this.lsbPresets); this.pbxPreview.Size = new System.Drawing.Size(950, 540);
this.groupBox4.Controls.Add(this.tbxPresetName); this.pbxPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.groupBox4.Controls.Add(this.btnSavePreset); this.pbxPreview.TabIndex = 0;
this.groupBox4.Controls.Add(this.lblWindowsRemaining); this.pbxPreview.TabStop = false;
this.groupBox4.Controls.Add(this.lblZonePointsRemaning); this.pbxPreview.Click += new System.EventHandler(this.pbxMain_Click);
this.groupBox4.Controls.Add(this.lblWindowPointsRemaining); this.pbxPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxMain_MouseClick);
this.groupBox4.Controls.Add(this.btnCreateWindow); //
this.groupBox4.Controls.Add(this.btnCreatZone); // btnCreatZone
this.groupBox4.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); //
this.groupBox4.Location = new System.Drawing.Point(1257, 55); this.btnCreatZone.Location = new System.Drawing.Point(6, 23);
this.groupBox4.Name = "groupBox4"; this.btnCreatZone.Name = "btnCreatZone";
this.groupBox4.Size = new System.Drawing.Size(213, 608); this.btnCreatZone.Size = new System.Drawing.Size(201, 33);
this.groupBox4.TabIndex = 6; this.btnCreatZone.TabIndex = 1;
this.groupBox4.TabStop = false; this.btnCreatZone.Text = "Create the main zone";
this.groupBox4.Text = "Calibration settings"; this.btnCreatZone.UseVisualStyleBackColor = true;
this.btnCreatZone.Click += new System.EventHandler(this.btnCreatZone_Click);
//
// gpbxWindowPreview
//
this.gpbxWindowPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.gpbxWindowPreview.Controls.Add(this.pbxWindowPreview);
this.gpbxWindowPreview.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.gpbxWindowPreview.Location = new System.Drawing.Point(8, 669);
this.gpbxWindowPreview.Name = "gpbxWindowPreview";
this.gpbxWindowPreview.Size = new System.Drawing.Size(1227, 88);
this.gpbxWindowPreview.TabIndex = 5;
this.gpbxWindowPreview.TabStop = false;
this.gpbxWindowPreview.Text = "DriverZonePreview";
//
// pbxWindowPreview
//
this.pbxWindowPreview.Location = new System.Drawing.Point(6, 30);
this.pbxWindowPreview.Name = "pbxWindowPreview";
this.pbxWindowPreview.Size = new System.Drawing.Size(1212, 50);
this.pbxWindowPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbxWindowPreview.TabIndex = 0;
this.pbxWindowPreview.TabStop = false;
this.pbxWindowPreview.Click += new System.EventHandler(this.pbxDriverZone_Click);
this.pbxWindowPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxDriverZone_MouseClick);
// //
// btnLoadPreset // btnLoadPreset
// //
this.btnLoadPreset.Location = new System.Drawing.Point(6, 297); this.btnLoadPreset.Location = new System.Drawing.Point(10, 194);
this.btnLoadPreset.Name = "btnLoadPreset"; this.btnLoadPreset.Name = "btnLoadPreset";
this.btnLoadPreset.Size = new System.Drawing.Size(201, 40); this.btnLoadPreset.Size = new System.Drawing.Size(243, 40);
this.btnLoadPreset.TabIndex = 10; this.btnLoadPreset.TabIndex = 10;
this.btnLoadPreset.Text = "LoadPreset"; this.btnLoadPreset.Text = "Load the preset";
this.btnLoadPreset.UseVisualStyleBackColor = true; this.btnLoadPreset.UseVisualStyleBackColor = true;
this.btnLoadPreset.Click += new System.EventHandler(this.btnLoadPreset_Click); this.btnLoadPreset.Click += new System.EventHandler(this.btnLoadPreset_Click);
// //
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 337);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(68, 23);
this.label8.TabIndex = 9;
this.label8.Text = "Presets";
//
// lsbPresets // lsbPresets
// //
this.lsbPresets.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.lsbPresets.FormattingEnabled = true; this.lsbPresets.FormattingEnabled = true;
this.lsbPresets.ItemHeight = 23; this.lsbPresets.ItemHeight = 23;
this.lsbPresets.Location = new System.Drawing.Point(10, 363); this.lsbPresets.Location = new System.Drawing.Point(10, 23);
this.lsbPresets.Name = "lsbPresets"; this.lsbPresets.Name = "lsbPresets";
this.lsbPresets.Size = new System.Drawing.Size(197, 234); this.lsbPresets.Size = new System.Drawing.Size(243, 119);
this.lsbPresets.TabIndex = 8; this.lsbPresets.TabIndex = 8;
this.lsbPresets.SelectedIndexChanged += new System.EventHandler(this.lsbPresets_SelectedIndexChanged); this.lsbPresets.SelectedIndexChanged += new System.EventHandler(this.lsbPresets_SelectedIndexChanged);
// //
// tbxPresetName // tbxPresetName
// //
this.tbxPresetName.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tbxPresetName.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxPresetName.Location = new System.Drawing.Point(10, 216); this.tbxPresetName.Location = new System.Drawing.Point(10, 286);
this.tbxPresetName.Name = "tbxPresetName"; this.tbxPresetName.Name = "tbxPresetName";
this.tbxPresetName.Size = new System.Drawing.Size(197, 29); this.tbxPresetName.Size = new System.Drawing.Size(243, 29);
this.tbxPresetName.TabIndex = 7; this.tbxPresetName.TabIndex = 7;
// //
// btnSavePreset // btnSavePreset
// //
this.btnSavePreset.Location = new System.Drawing.Point(6, 251); this.btnSavePreset.Location = new System.Drawing.Point(10, 240);
this.btnSavePreset.Name = "btnSavePreset"; this.btnSavePreset.Name = "btnSavePreset";
this.btnSavePreset.Size = new System.Drawing.Size(201, 40); this.btnSavePreset.Size = new System.Drawing.Size(243, 40);
this.btnSavePreset.TabIndex = 7; this.btnSavePreset.TabIndex = 7;
this.btnSavePreset.Text = "Save as new preset"; this.btnSavePreset.Text = "Save current preset";
this.btnSavePreset.UseVisualStyleBackColor = true; this.btnSavePreset.UseVisualStyleBackColor = true;
this.btnSavePreset.Click += new System.EventHandler(this.btnSavePreset_Click); this.btnSavePreset.Click += new System.EventHandler(this.btnSavePreset_Click);
// //
// lblWindowsRemaining // gpbxPresets
// //
this.lblWindowsRemaining.AutoSize = true; this.gpbxPresets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblWindowsRemaining.Location = new System.Drawing.Point(6, 184); this.gpbxPresets.Controls.Add(this.btnSavePreset);
this.lblWindowsRemaining.Name = "lblWindowsRemaining"; this.gpbxPresets.Controls.Add(this.btnDeletePreset);
this.lblWindowsRemaining.Size = new System.Drawing.Size(183, 23); this.gpbxPresets.Controls.Add(this.tbxPresetName);
this.lblWindowsRemaining.TabIndex = 6; this.gpbxPresets.Controls.Add(this.btnLoadPreset);
this.lblWindowsRemaining.Text = "7 windows remaining"; this.gpbxPresets.Controls.Add(this.lsbPresets);
this.gpbxPresets.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.gpbxPresets.Location = new System.Drawing.Point(976, 330);
this.gpbxPresets.Name = "gpbxPresets";
this.gpbxPresets.Size = new System.Drawing.Size(259, 333);
this.gpbxPresets.TabIndex = 6;
this.gpbxPresets.TabStop = false;
this.gpbxPresets.Text = "Presets";
// //
// lblZonePointsRemaning // btnDeletePreset
// //
this.lblZonePointsRemaning.AutoSize = true; this.btnDeletePreset.Location = new System.Drawing.Point(10, 148);
this.lblZonePointsRemaning.Location = new System.Drawing.Point(6, 85); this.btnDeletePreset.Name = "btnDeletePreset";
this.lblZonePointsRemaning.Name = "lblZonePointsRemaning"; this.btnDeletePreset.Size = new System.Drawing.Size(243, 40);
this.lblZonePointsRemaning.Size = new System.Drawing.Size(163, 23); this.btnDeletePreset.TabIndex = 11;
this.lblZonePointsRemaning.TabIndex = 5; this.btnDeletePreset.Text = "Delete the preset";
this.lblZonePointsRemaning.Text = "0 points remaining"; this.btnDeletePreset.UseVisualStyleBackColor = true;
// this.btnDeletePreset.Click += new System.EventHandler(this.btnDeletePreset_Click);
// lblWindowPointsRemaining
//
this.lblWindowPointsRemaining.AutoSize = true;
this.lblWindowPointsRemaining.Location = new System.Drawing.Point(6, 161);
this.lblWindowPointsRemaining.Name = "lblWindowPointsRemaining";
this.lblWindowPointsRemaining.Size = new System.Drawing.Size(163, 23);
this.lblWindowPointsRemaining.TabIndex = 4;
this.lblWindowPointsRemaining.Text = "0 points remaining";
//
// btnCreateWindow
//
this.btnCreateWindow.Location = new System.Drawing.Point(6, 118);
this.btnCreateWindow.Name = "btnCreateWindow";
this.btnCreateWindow.Size = new System.Drawing.Size(201, 40);
this.btnCreateWindow.TabIndex = 2;
this.btnCreateWindow.Text = "Create new Window";
this.btnCreateWindow.UseVisualStyleBackColor = true;
this.btnCreateWindow.Click += new System.EventHandler(this.btnCreateWindow_Click);
//
// btnCreatZone
//
this.btnCreatZone.Location = new System.Drawing.Point(6, 42);
this.btnCreatZone.Name = "btnCreatZone";
this.btnCreatZone.Size = new System.Drawing.Size(201, 40);
this.btnCreatZone.TabIndex = 1;
this.btnCreatZone.Text = "Create main zone";
this.btnCreatZone.UseVisualStyleBackColor = true;
this.btnCreatZone.Click += new System.EventHandler(this.btnCreatZone_Click);
// //
// Settings // Settings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1478, 760); this.ClientSize = new System.Drawing.Size(1244, 760);
this.Controls.Add(this.groupBox4); this.Controls.Add(this.gpbxPresets);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.gpbxWindowPreview);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.gpbxPreview);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.gpbxDriverList);
this.Controls.Add(this.gpbxInfos);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.gpbxRaceSettings);
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MinimumSize = new System.Drawing.Size(1262, 807);
this.Name = "Settings"; this.Name = "Settings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Settings"; this.Text = "Settings";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Settings_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Settings_FormClosing);
this.gpbxInfos.ResumeLayout(false); this.Resize += new System.EventHandler(this.Settings_Resize);
this.gpbxInfos.PerformLayout(); this.gpbxRaceSettings.ResumeLayout(false);
this.groupBox1.ResumeLayout(false); this.gpbxRaceSettings.PerformLayout();
this.groupBox1.PerformLayout(); this.gpbxDriverList.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.gpbxDriverList.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxMain)).EndInit(); this.gpbxPreview.ResumeLayout(false);
this.groupBox3.ResumeLayout(false); this.gpbxPreview.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxDriverZone)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxPreview)).EndInit();
this.groupBox4.ResumeLayout(false); this.gpbxWindowPreview.ResumeLayout(false);
this.groupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbxWindowPreview)).EndInit();
this.gpbxPresets.ResumeLayout(false);
this.gpbxPresets.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -419,22 +385,17 @@
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox gpbxInfos; private System.Windows.Forms.GroupBox gpbxRaceSettings;
private System.Windows.Forms.TextBox tbxGpYear;
private System.Windows.Forms.TextBox tbxGpName;
private System.Windows.Forms.TextBox tbxGpUrl; private System.Windows.Forms.TextBox tbxGpUrl;
private System.Windows.Forms.Label label4; private System.Windows.Forms.GroupBox gpbxDriverList;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ListBox lsbDrivers; private System.Windows.Forms.ListBox lsbDrivers;
private System.Windows.Forms.Button btnRemoveDriver; private System.Windows.Forms.Button btnRemoveDriver;
private System.Windows.Forms.Button btnAddDriver; private System.Windows.Forms.Button btnAddDriver;
private System.Windows.Forms.TextBox tbxDriverName; private System.Windows.Forms.TextBox tbxDriverName;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox gpbxPreview;
private System.Windows.Forms.PictureBox pbxMain; private System.Windows.Forms.PictureBox pbxPreview;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox gpbxWindowPreview;
private System.Windows.Forms.PictureBox pbxDriverZone; private System.Windows.Forms.PictureBox pbxWindowPreview;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button btnCreateWindow; private System.Windows.Forms.Button btnCreateWindow;
private System.Windows.Forms.Button btnCreatZone; private System.Windows.Forms.Button btnCreatZone;
private System.Windows.Forms.ListBox lsbPresets; private System.Windows.Forms.ListBox lsbPresets;
@@ -443,9 +404,10 @@
private System.Windows.Forms.Label lblWindowsRemaining; private System.Windows.Forms.Label lblWindowsRemaining;
private System.Windows.Forms.Label lblZonePointsRemaning; private System.Windows.Forms.Label lblZonePointsRemaning;
private System.Windows.Forms.Label lblWindowPointsRemaining; private System.Windows.Forms.Label lblWindowPointsRemaining;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button btnRefresh; private System.Windows.Forms.Button btnRefresh;
private System.Windows.Forms.Button btnResetDriver; private System.Windows.Forms.Button btnResetDriver;
private System.Windows.Forms.Button btnLoadPreset; private System.Windows.Forms.Button btnLoadPreset;
private System.Windows.Forms.GroupBox gpbxPresets;
private System.Windows.Forms.Button btnDeletePreset;
} }
} }
+58 -39
View File
@@ -14,8 +14,6 @@ namespace Test_Merge
public partial class Settings : Form public partial class Settings : Form
{ {
private string _grandPrixUrl = ""; private string _grandPrixUrl = "";
private string _grandPrixName = "";
private int _grandPrixYear = 2000;
private string _selectedConfigFile; private string _selectedConfigFile;
private List<string> _driverList = new List<string>(); private List<string> _driverList = new List<string>();
@@ -33,11 +31,17 @@ namespace Test_Merge
List<Rectangle> WindowsToAdd = new List<Rectangle>(); List<Rectangle> WindowsToAdd = new List<Rectangle>();
public string GrandPrixUrl { get => _grandPrixUrl; private set => _grandPrixUrl = value; } public string GrandPrixUrl { get => _grandPrixUrl; private set => _grandPrixUrl = value; }
public string GrandPrixName { get => _grandPrixName; private set => _grandPrixName = value; }
public int GrandPrixYear { get => _grandPrixYear; private set => _grandPrixYear = value; }
public List<string> DriverList { get => _driverList; private set => _driverList = value; } public List<string> DriverList { get => _driverList; private set => _driverList = value; }
public string SelectedConfigFile { get => _selectedConfigFile; private set => _selectedConfigFile = value; } public string SelectedConfigFile { get => _selectedConfigFile; private set => _selectedConfigFile = value; }
//For the responsive content
Size oldSize = new Size();
Size oldGpbxPreviewSize = new Size();
Size oldGpbxWindowPreviewSize = new Size();
Size oldPbxPreviewSize = new Size();
Size oldPbxWindowPreviewSize = new Size();
public Settings() public Settings()
{ {
InitializeComponent(); InitializeComponent();
@@ -46,6 +50,11 @@ namespace Test_Merge
private void Load() private void Load()
{ {
RefreshUI(); RefreshUI();
oldSize = this.Size;
oldGpbxPreviewSize = gpbxPreview.Size;
oldGpbxWindowPreviewSize = gpbxWindowPreview.Size;
oldPbxPreviewSize = pbxPreview.Size;
oldPbxWindowPreviewSize = pbxWindowPreview.Size;
} }
private void RefreshUI() private void RefreshUI()
{ {
@@ -93,15 +102,15 @@ namespace Test_Merge
} }
if (Config != null) if (Config != null)
{ {
pbxMain.Image = Config.MainZone.Draw(); pbxPreview.Image = Config.MainZone.Draw();
if (Config.MainZone.Zones.Count > 0) if (Config.MainZone.Zones.Count > 0)
pbxDriverZone.Image = Config.MainZone.Zones[0].Draw(); pbxWindowPreview.Image = Config.MainZone.Zones[0].Draw();
} }
} }
private void CreateNewZone(Point p1, Point p2) private void CreateNewZone(Point p1, Point p2)
{ {
Rectangle dimensions = CreateAbsoluteRectangle(p1, p2); Rectangle dimensions = CreateAbsoluteRectangle(p1, p2);
Config = new ConfigurationTool((Bitmap)pbxMain.Image, dimensions); Config = new ConfigurationTool((Bitmap)pbxPreview.Image, dimensions);
RefreshUI(); RefreshUI();
} }
private void CreateWindows(List<Rectangle> dimensions) private void CreateWindows(List<Rectangle> dimensions)
@@ -116,25 +125,6 @@ namespace Test_Merge
GrandPrixUrl = tbxGpUrl.Text; GrandPrixUrl = tbxGpUrl.Text;
} }
private void tbxGpName_TextChanged(object sender, EventArgs e)
{
GrandPrixName = tbxGpName.Text;
}
private void tbxGpYear_TextChanged(object sender, EventArgs e)
{
int year;
try
{
year = Convert.ToInt32(tbxGpYear.Text);
}
catch
{
year = 1545;
}
GrandPrixYear = year;
}
private void btnAddDriver_Click(object sender, EventArgs e) private void btnAddDriver_Click(object sender, EventArgs e)
{ {
string newDriver = tbxDriverName.Text; string newDriver = tbxDriverName.Text;
@@ -171,7 +161,7 @@ namespace Test_Merge
if (Emulator != null && Emulator.Ready) if (Emulator != null && Emulator.Ready)
{ {
Config = null; Config = null;
pbxMain.Image = Emulator.Screenshot(); pbxPreview.Image = Emulator.Screenshot();
} }
ZoneP1 = new Point(-1, -1); ZoneP1 = new Point(-1, -1);
@@ -214,12 +204,12 @@ namespace Test_Merge
} }
private void pbxMain_MouseClick(object sender, MouseEventArgs e) private void pbxMain_MouseClick(object sender, MouseEventArgs e)
{ {
if (CreatingZone && pbxMain.Image != null) if (CreatingZone && pbxPreview.Image != null)
{ {
//Point coordinates = pbxMain.PointToClient(new Point(MousePosition.X, MousePosition.Y)); //Point coordinates = pbxMain.PointToClient(new Point(MousePosition.X, MousePosition.Y));
Point coordinates = e.Location; Point coordinates = e.Location;
float xOffset = (float)pbxMain.Image.Width / (float)pbxMain.Width; float xOffset = (float)pbxPreview.Image.Width / (float)pbxPreview.Width;
float yOffset = (float)pbxMain.Image.Height / (float)pbxMain.Height; float yOffset = (float)pbxPreview.Image.Height / (float)pbxPreview.Height;
Point newPoint = new Point(Convert.ToInt32((float)coordinates.X * xOffset), Convert.ToInt32((float)coordinates.Y * yOffset)); Point newPoint = new Point(Convert.ToInt32((float)coordinates.X * xOffset), Convert.ToInt32((float)coordinates.Y * yOffset));
//MessageBox.Show("Coordinates" + Environment.NewLine + "Old : " + coordinates.ToString() + Environment.NewLine + "New : " + newPoint.ToString()); //MessageBox.Show("Coordinates" + Environment.NewLine + "Old : " + coordinates.ToString() + Environment.NewLine + "New : " + newPoint.ToString());
@@ -243,12 +233,12 @@ namespace Test_Merge
} }
private void pbxDriverZone_MouseClick(object sender, MouseEventArgs e) private void pbxDriverZone_MouseClick(object sender, MouseEventArgs e)
{ {
if (CreatingWindow && pbxDriverZone.Image != null) if (CreatingWindow && pbxWindowPreview.Image != null)
{ {
Point coordinates = e.Location; Point coordinates = e.Location;
float xOffset = (float)pbxDriverZone.Image.Width / (float)pbxDriverZone.Width; float xOffset = (float)pbxWindowPreview.Image.Width / (float)pbxWindowPreview.Width;
float yOffset = (float)pbxDriverZone.Image.Height / (float)pbxDriverZone.Height; float yOffset = (float)pbxWindowPreview.Image.Height / (float)pbxWindowPreview.Height;
Point newPoint = new Point(Convert.ToInt32((float)coordinates.X * xOffset), Convert.ToInt32((float)coordinates.Y * yOffset)); Point newPoint = new Point(Convert.ToInt32((float)coordinates.X * xOffset), Convert.ToInt32((float)coordinates.Y * yOffset));
@@ -269,7 +259,7 @@ namespace Test_Merge
else else
{ {
WindowP1 = new Point(WindowP1.X, 0); WindowP1 = new Point(WindowP1.X, 0);
WindowP2 = new Point(WindowP2.X, pbxDriverZone.Image.Height); WindowP2 = new Point(WindowP2.X, pbxWindowPreview.Image.Height);
CreateWindows(WindowsToAdd); CreateWindows(WindowsToAdd);
SwitchWindowCreation(); SwitchWindowCreation();
} }
@@ -353,12 +343,12 @@ namespace Test_Merge
} }
else else
{ {
pbxMain.Image = Emulator.Screenshot(); pbxPreview.Image = Emulator.Screenshot();
} }
} }
else else
{ {
pbxMain.Image = Emulator.Screenshot(); pbxPreview.Image = Emulator.Screenshot();
} }
btnRefresh.Enabled = true; btnRefresh.Enabled = true;
} }
@@ -397,14 +387,14 @@ namespace Test_Merge
private void btnLoadPreset_Click(object sender, EventArgs e) private void btnLoadPreset_Click(object sender, EventArgs e)
{ {
//MessageBox.Show(lsbPresets.SelectedIndex.ToString()); //MessageBox.Show(lsbPresets.SelectedIndex.ToString());
if (lsbPresets.SelectedIndex >= 0 && pbxMain.Image != null) if (lsbPresets.SelectedIndex >= 0 && pbxPreview.Image != null)
{ {
try try
{ {
string fileName = lsbPresets.Items[lsbPresets.SelectedIndex].ToString(); string fileName = lsbPresets.Items[lsbPresets.SelectedIndex].ToString();
Reader reader = new Reader(fileName, (Bitmap)pbxMain.Image, false); Reader reader = new Reader(fileName, (Bitmap)pbxPreview.Image, false);
//MainZones #0 is the big main zone containing driver zones //MainZones #0 is the big main zone containing driver zones
Config = new ConfigurationTool((Bitmap)pbxMain.Image, reader.MainZones[0].Bounds); Config = new ConfigurationTool((Bitmap)pbxPreview.Image, reader.MainZones[0].Bounds);
Config.MainZone = reader.MainZones[0]; Config.MainZone = reader.MainZones[0];
DriverList = reader.Drivers; DriverList = reader.Drivers;
SelectedConfigFile = fileName; SelectedConfigFile = fileName;
@@ -416,5 +406,34 @@ namespace Test_Merge
RefreshUI(); RefreshUI();
} }
} }
private void Settings_Resize(object sender, EventArgs e)
{
int xDiff = this.Width - oldSize.Width;
int yDiff = this.Height - oldSize.Height;
gpbxPreview.Size = new Size(oldGpbxPreviewSize.Width + xDiff,oldGpbxPreviewSize.Height + yDiff);
gpbxWindowPreview.Size = new Size(oldGpbxWindowPreviewSize.Width + xDiff,oldGpbxWindowPreviewSize.Height);
pbxPreview.Size = new Size(oldPbxPreviewSize.Width + xDiff,oldPbxPreviewSize.Height + yDiff);
pbxWindowPreview.Size = new Size(oldPbxWindowPreviewSize.Width + xDiff,oldPbxWindowPreviewSize.Height);
}
private void btnDeletePreset_Click(object sender, EventArgs e)
{
int selectedIndex = lsbPresets.SelectedIndex;
if (selectedIndex >= 0)
{
string fileName = lsbPresets.Items[selectedIndex].ToString();
if (File.Exists(fileName))
{
File.Delete(fileName);
RefreshUI();
}
else
{
MessageBox.Show("Could not delete the preset because it does not exists");
}
}
}
} }
} }