Skip to content

Commit

Permalink
Save popup size/divider in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
gerhardol committed Jan 23, 2016
1 parent b1a07f9 commit c40b3e2
Showing 1 changed file with 79 additions and 5 deletions.
84 changes: 79 additions & 5 deletions Data/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ static class Settings
private static bool m_ShowTrailPointsOnMap;
private static bool m_ShowListToolBar;
private static byte m_RouteLineAlpha;
private static Size m_PopupSize = new Size(600, 450);
private static int m_PopupDivider = 100;
private static bool m_PopupInActionMenu = true;
private static bool m_PopupUpdatedBySelection = false;

//properties not in xml can be handled as variables, no write trigger needed
public static bool OverlappingResultUseTimeOfDayDiff; //not in xml
Expand All @@ -96,10 +100,6 @@ static class Settings
public static int GpsFilterMinimumTime; //not in xml
public static float GpsFilterMinimumDistance; //not in xml
public static int SelectSimilarModulu; //not in xml
public static Size PopupSize = new Size(600, 450); //not in xml
public static int PopupDivider = 100; //not in xml
public static bool PopupInActionMenu = true; //not in xml
public static bool PopupUpdatedBySelection = false; //not in xml

public static void Init()
{
Expand Down Expand Up @@ -173,6 +173,11 @@ private static void defaults()
GpsFilterMinimumTime = 2;
GpsFilterMinimumDistance = 10f;
SelectSimilarModulu = 0;

m_PopupSize = new Size(600, 450);
m_PopupDivider = 100;
m_PopupInActionMenu = true;
m_PopupUpdatedBySelection = false;
}

private static bool isHandlingXml = false;
Expand Down Expand Up @@ -883,6 +888,46 @@ public static byte RouteLineAlpha
}
}

public static Size PopupSize
{
get { return m_PopupSize; }
set
{
m_PopupSize = value;
WriteExtensionData();
}
}

public static int PopupDivider
{
get { return m_PopupDivider; }
set
{
m_PopupDivider = value;
WriteExtensionData();
}
}

public static bool PopupInActionMenu
{
get { return m_PopupInActionMenu; }
set
{
m_PopupInActionMenu = value;
WriteExtensionData();
}
}

public static bool PopupUpdatedBySelection
{
get { return m_PopupUpdatedBySelection; }
set
{
m_PopupUpdatedBySelection = value;
WriteExtensionData();
}
}

/******************************************************/
public static void ReadOptions(XmlDocument xmlDoc, XmlNamespaceManager nsmgr, XmlElement pluginNode)
{
Expand Down Expand Up @@ -1024,7 +1069,24 @@ public static void ReadOptions(XmlDocument xmlDoc, XmlNamespaceManager nsmgr, Xm
attr = pluginNode.GetAttribute(xmlTags.sMaxChartResults);
if (attr.Length > 0) { m_MaxChartResults = XmlConvert.ToInt32(attr); }

attr = pluginNode.GetAttribute(xmlTags.sColumns);
int popupWidth = 0;
int popupHeight = 0;
attr = pluginNode.GetAttribute(xmlTags.sPopupSizeWidth);
if (attr.Length > 0) { popupWidth = XmlConvert.ToInt16(attr); }
attr = pluginNode.GetAttribute(xmlTags.sPopupSizeHeight);
if (attr.Length > 0) { popupHeight = XmlConvert.ToInt16(attr); }
if (popupWidth > 0 && popupHeight > 0)
{
m_PopupSize = new Size(popupWidth, popupHeight);
}
attr = pluginNode.GetAttribute(xmlTags.sPopupDivider);
if (attr.Length > 0) { m_PopupDivider = XmlConvert.ToInt32(attr); }
attr = pluginNode.GetAttribute(xmlTags.sPopupInActionMenu);
if (attr.Length > 0) { m_PopupInActionMenu = XmlConvert.ToBoolean(attr); }
attr = pluginNode.GetAttribute(xmlTags.sPopupUpdatedBySelection);
if (attr.Length > 0) { m_PopupUpdatedBySelection = XmlConvert.ToBoolean(attr); }

attr = pluginNode.GetAttribute(xmlTags.sColumns);
if (attr.Length > 0)
{
m_activityPageColumns.Clear();
Expand Down Expand Up @@ -1153,6 +1215,12 @@ public static void WriteOptions(XmlDocument xmlDoc, XmlElement pluginNode)
pluginNode.SetAttribute(xmlTags.MaxAutoCalcActivitiesSingleTrail, XmlConvert.ToString(m_MaxAutoCalcActivitiesSingleTrail));
pluginNode.SetAttribute(xmlTags.sMaxChartResults, XmlConvert.ToString(m_MaxChartResults));

pluginNode.SetAttribute(xmlTags.sPopupSizeWidth, XmlConvert.ToString(m_PopupSize.Width));
pluginNode.SetAttribute(xmlTags.sPopupSizeHeight, XmlConvert.ToString(m_PopupSize.Height));
pluginNode.SetAttribute(xmlTags.sPopupDivider, XmlConvert.ToString(m_PopupDivider));
pluginNode.SetAttribute(xmlTags.sPopupInActionMenu, XmlConvert.ToString(m_PopupInActionMenu));
pluginNode.SetAttribute(xmlTags.sPopupUpdatedBySelection, XmlConvert.ToString(m_PopupUpdatedBySelection));

colText = null;
TrailResultColumns cols = new TrailResultColumns(null, 1, true, true);
foreach (String column in m_activityPageColumns)
Expand Down Expand Up @@ -1243,6 +1311,12 @@ private class xmlTags
public const string sShowTrailPointsOnChart = "sShowTrailPointsOnChart";
public const string sShowTrailPointsOnMap = "sShowTrailPointsOnMap";

public const string sPopupSizeWidth = "sPopupSizeWidth";
public const string sPopupSizeHeight = "sPopupSizeHeight";
public const string sPopupDivider = "sPopupDivider";
public const string sPopupInActionMenu = "sPopupInActionMenu";
public const string sPopupUpdatedBySelection = "sPopupUpdatedBySelection";

public const string sColumns = "sColumns";
}

Expand Down

0 comments on commit c40b3e2

Please sign in to comment.