Save form position

Related to issue #142.
This commit is contained in:
Travis Nickles 2017-11-05 20:18:36 -06:00
parent a8c045e8ef
commit 5df02aafa7
3 changed files with 63 additions and 36 deletions

View File

@ -423,7 +423,7 @@ namespace DS4Windows
public static int FormWidth
{
set { m_Config.formWidth = value; }
get { return m_Config.formWidth;}
get { return m_Config.formWidth; }
}
public static int FormHeight
@ -432,6 +432,18 @@ namespace DS4Windows
get { return m_Config.formHeight; }
}
public static int FormLocationX
{
set { m_Config.formLocationX = value; }
get { return m_Config.formLocationX; }
}
public static int FormLocationY
{
set { m_Config.formLocationY = value; }
get { return m_Config.formLocationY; }
}
public static bool DownloadLang
{
set { m_Config.downloadLang = value; }
@ -1309,6 +1321,8 @@ namespace DS4Windows
public Boolean useExclusiveMode = false;
public Int32 formWidth = 782;
public Int32 formHeight = 550;
public int formLocationX = 0;
public int formLocationY = 0;
public Boolean startMinimized = false;
public DateTime lastChecked;
public int CheckWhen = 1;
@ -2713,6 +2727,11 @@ namespace DS4Windows
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/formHeight"); Int32.TryParse(Item.InnerText, out formHeight); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/formLocationX"); Int32.TryParse(Item.InnerText, out formLocationX); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/formLocationY"); Int32.TryParse(Item.InnerText, out formLocationY); }
catch { missingSetting = true; }
try {
Item = m_Xdoc.SelectSingleNode("/Profile/Controller1"); profilePath[0] = Item.InnerText;
if (profilePath[0].ToLower().Contains("distance"))
@ -2824,11 +2843,12 @@ namespace DS4Windows
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "Profile", null);
XmlNode xmlUseExclNode = m_Xdoc.CreateNode(XmlNodeType.Element, "useExclusiveMode", null); xmlUseExclNode.InnerText = useExclusiveMode.ToString(); Node.AppendChild(xmlUseExclNode);
XmlNode xmlStartMinimized = m_Xdoc.CreateNode(XmlNodeType.Element, "startMinimized", null); xmlStartMinimized.InnerText = startMinimized.ToString(); Node.AppendChild(xmlStartMinimized);
XmlNode xmlFormWidth = m_Xdoc.CreateNode(XmlNodeType.Element, "formWidth", null); xmlFormWidth.InnerText = formWidth.ToString(); Node.AppendChild(xmlFormWidth);
XmlNode xmlFormHeight = m_Xdoc.CreateNode(XmlNodeType.Element, "formHeight", null); xmlFormHeight.InnerText = formHeight.ToString(); Node.AppendChild(xmlFormHeight);
XmlNode xmlFormLocationX = m_Xdoc.CreateNode(XmlNodeType.Element, "formLocationX", null); xmlFormLocationX.InnerText = formLocationX.ToString(); Node.AppendChild(xmlFormLocationX);
XmlNode xmlFormLocationY = m_Xdoc.CreateNode(XmlNodeType.Element, "formLocationY", null); xmlFormLocationY.InnerText = formLocationY.ToString(); Node.AppendChild(xmlFormLocationY);
XmlNode xmlController1 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller1", null); xmlController1.InnerText = !Global.linkedProfileCheck[0] ? profilePath[0] : olderProfilePath[0]; Node.AppendChild(xmlController1);
XmlNode xmlController2 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller2", null); xmlController2.InnerText = !Global.linkedProfileCheck[1] ? profilePath[1] : olderProfilePath[1]; Node.AppendChild(xmlController2);

View File

@ -236,6 +236,7 @@ namespace DS4Windows
// New settings
this.Width = FormWidth;
this.Height = FormHeight;
this.Location = new Point(FormLocationX, FormLocationY);
startMinimizedCheckBox.CheckedChanged -= startMinimizedCheckBox_CheckedChanged;
startMinimizedCheckBox.Checked = StartMinimized;
startMinimizedCheckBox.CheckedChanged += startMinimizedCheckBox_CheckedChanged;
@ -2180,6 +2181,9 @@ namespace DS4Windows
FormHeight = oldsize.Height;
}
FormLocationX = this.Location.X;
FormLocationY = this.Location.Y;
if (!string.IsNullOrEmpty(appdatapath))
{
Save();

View File

@ -469,10 +469,10 @@
<value>NoControl</value>
</data>
<data name="bnLight3.Location" type="System.Drawing.Point, System.Drawing">
<value>794, 89</value>
<value>793, 89</value>
</data>
<data name="bnLight3.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 22</value>
<value>100, 22</value>
</data>
<data name="bnLight3.TabIndex" type="System.Int32, mscorlib">
<value>50</value>
@ -496,7 +496,7 @@
<value>NoControl</value>
</data>
<data name="pBStatus1.Location" type="System.Drawing.Point, System.Drawing">
<value>363, 34</value>
<value>362, 34</value>
</data>
<data name="pBStatus1.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value>
@ -598,7 +598,7 @@
<value>NoControl</value>
</data>
<data name="bnEditC3.Location" type="System.Drawing.Point, System.Drawing">
<value>754, 89</value>
<value>753, 89</value>
</data>
<data name="bnEditC3.Size" type="System.Drawing.Size, System.Drawing">
<value>34, 22</value>
@ -628,7 +628,7 @@
<value>NoControl</value>
</data>
<data name="bnEditC4.Location" type="System.Drawing.Point, System.Drawing">
<value>754, 117</value>
<value>753, 117</value>
</data>
<data name="bnEditC4.Size" type="System.Drawing.Size, System.Drawing">
<value>34, 22</value>
@ -727,7 +727,7 @@
<value>None</value>
</data>
<data name="cBController1.Location" type="System.Drawing.Point, System.Drawing">
<value>637, 33</value>
<value>636, 33</value>
</data>
<data name="cBController1.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value>
@ -754,7 +754,7 @@
<value>NoControl</value>
</data>
<data name="bnEditC2.Location" type="System.Drawing.Point, System.Drawing">
<value>754, 61</value>
<value>753, 61</value>
</data>
<data name="bnEditC2.Size" type="System.Drawing.Size, System.Drawing">
<value>34, 22</value>
@ -781,7 +781,7 @@
<value>None</value>
</data>
<data name="cBController2.Location" type="System.Drawing.Point, System.Drawing">
<value>637, 61</value>
<value>636, 61</value>
</data>
<data name="cBController2.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value>
@ -805,7 +805,7 @@
<value>None</value>
</data>
<data name="cBController3.Location" type="System.Drawing.Point, System.Drawing">
<value>637, 89</value>
<value>636, 89</value>
</data>
<data name="cBController3.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value>
@ -832,7 +832,7 @@
<value>NoControl</value>
</data>
<data name="bnEditC1.Location" type="System.Drawing.Point, System.Drawing">
<value>754, 33</value>
<value>753, 33</value>
</data>
<data name="bnEditC1.Size" type="System.Drawing.Size, System.Drawing">
<value>34, 22</value>
@ -859,7 +859,7 @@
<value>None</value>
</data>
<data name="cBController4.Location" type="System.Drawing.Point, System.Drawing">
<value>637, 117</value>
<value>636, 117</value>
</data>
<data name="cBController4.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value>
@ -892,7 +892,7 @@
<value>NoControl</value>
</data>
<data name="lbSelectedProfile.Location" type="System.Drawing.Point, System.Drawing">
<value>638, 7</value>
<value>637, 7</value>
</data>
<data name="lbSelectedProfile.Size" type="System.Drawing.Size, System.Drawing">
<value>109, 15</value>
@ -964,7 +964,7 @@
<value>NoControl</value>
</data>
<data name="lbStatus.Location" type="System.Drawing.Point, System.Drawing">
<value>359, 7</value>
<value>358, 7</value>
</data>
<data name="lbStatus.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 15</value>
@ -1000,7 +1000,7 @@
<value>NoControl</value>
</data>
<data name="lbBattery.Location" type="System.Drawing.Point, System.Drawing">
<value>472, 7</value>
<value>471, 7</value>
</data>
<data name="lbBattery.Size" type="System.Drawing.Size, System.Drawing">
<value>51, 15</value>
@ -1036,7 +1036,7 @@
<value>NoControl</value>
</data>
<data name="lbBatt1.Location" type="System.Drawing.Point, System.Drawing">
<value>478, 36</value>
<value>477, 36</value>
</data>
<data name="lbBatt1.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value>
@ -1072,7 +1072,7 @@
<value>NoControl</value>
</data>
<data name="lbBatt2.Location" type="System.Drawing.Point, System.Drawing">
<value>478, 64</value>
<value>477, 64</value>
</data>
<data name="lbBatt2.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value>
@ -1108,7 +1108,7 @@
<value>NoControl</value>
</data>
<data name="lbBatt3.Location" type="System.Drawing.Point, System.Drawing">
<value>478, 92</value>
<value>477, 92</value>
</data>
<data name="lbBatt3.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value>
@ -1144,7 +1144,7 @@
<value>NoControl</value>
</data>
<data name="lbBatt4.Location" type="System.Drawing.Point, System.Drawing">
<value>478, 120</value>
<value>477, 120</value>
</data>
<data name="lbBatt4.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value>
@ -1174,7 +1174,7 @@
<value>NoControl</value>
</data>
<data name="pBStatus2.Location" type="System.Drawing.Point, System.Drawing">
<value>363, 62</value>
<value>362, 62</value>
</data>
<data name="pBStatus2.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value>
@ -1204,7 +1204,7 @@
<value>NoControl</value>
</data>
<data name="pBStatus3.Location" type="System.Drawing.Point, System.Drawing">
<value>363, 90</value>
<value>362, 90</value>
</data>
<data name="pBStatus3.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value>
@ -1234,7 +1234,7 @@
<value>NoControl</value>
</data>
<data name="pBStatus4.Location" type="System.Drawing.Point, System.Drawing">
<value>363, 118</value>
<value>362, 118</value>
</data>
<data name="pBStatus4.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value>
@ -1267,10 +1267,10 @@
<value>NoControl</value>
</data>
<data name="bnLight1.Location" type="System.Drawing.Point, System.Drawing">
<value>794, 33</value>
<value>793, 33</value>
</data>
<data name="bnLight1.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 22</value>
<value>100, 22</value>
</data>
<data name="bnLight1.TabIndex" type="System.Int32, mscorlib">
<value>50</value>
@ -1297,10 +1297,10 @@
<value>NoControl</value>
</data>
<data name="bnLight2.Location" type="System.Drawing.Point, System.Drawing">
<value>794, 61</value>
<value>793, 61</value>
</data>
<data name="bnLight2.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 22</value>
<value>100, 22</value>
</data>
<data name="bnLight2.TabIndex" type="System.Int32, mscorlib">
<value>51</value>
@ -1327,10 +1327,10 @@
<value>NoControl</value>
</data>
<data name="bnLight4.Location" type="System.Drawing.Point, System.Drawing">
<value>794, 117</value>
<value>793, 117</value>
</data>
<data name="bnLight4.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 22</value>
<value>100, 22</value>
</data>
<data name="bnLight4.TabIndex" type="System.Int32, mscorlib">
<value>52</value>
@ -1360,7 +1360,7 @@
<value>NoControl</value>
</data>
<data name="lbLinkProfile.Location" type="System.Drawing.Point, System.Drawing">
<value>560, 0</value>
<value>559, 0</value>
</data>
<data name="lbLinkProfile.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 30</value>
@ -1399,7 +1399,7 @@
<value>NoControl</value>
</data>
<data name="linkCB1.Location" type="System.Drawing.Point, System.Drawing">
<value>586, 37</value>
<value>585, 37</value>
</data>
<data name="linkCB1.Size" type="System.Drawing.Size, System.Drawing">
<value>15, 14</value>
@ -1432,7 +1432,7 @@
<value>NoControl</value>
</data>
<data name="linkCB2.Location" type="System.Drawing.Point, System.Drawing">
<value>586, 65</value>
<value>585, 65</value>
</data>
<data name="linkCB2.Size" type="System.Drawing.Size, System.Drawing">
<value>15, 14</value>
@ -1465,7 +1465,7 @@
<value>NoControl</value>
</data>
<data name="linkCB3.Location" type="System.Drawing.Point, System.Drawing">
<value>586, 93</value>
<value>585, 93</value>
</data>
<data name="linkCB3.Size" type="System.Drawing.Size, System.Drawing">
<value>15, 14</value>
@ -1498,7 +1498,7 @@
<value>NoControl</value>
</data>
<data name="linkCB4.Location" type="System.Drawing.Point, System.Drawing">
<value>586, 121</value>
<value>585, 121</value>
</data>
<data name="linkCB4.Size" type="System.Drawing.Size, System.Drawing">
<value>15, 14</value>
@ -1546,7 +1546,7 @@
<value>1</value>
</data>
<data name="tLPControllers.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="bnLight3" Row="3" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="cBController1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="cBController2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="cBController3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="cBController4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="bnLight1" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="bnLight2" Row="2" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="bnLight4" Row="4" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="lbLinkProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,58.35329,Percent,21.22288,Percent,20.42383,Absolute,80,AutoSize,0,Absolute,40,Absolute,103" /&gt;&lt;Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="bnLight3" Row="3" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="cBController1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="cBController2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="cBController3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="cBController4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="bnLight1" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="bnLight2" Row="2" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="bnLight4" Row="4" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="lbLinkProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="linkCB4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,58.35329,Percent,21.22288,Percent,20.42383,Absolute,80,AutoSize,0,Absolute,40,Absolute,105" /&gt;&lt;Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="lbNoControllers.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
@ -3144,6 +3144,9 @@
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>630, 229</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>Manual</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>DS4Windows</value>
</data>