Mateiral Pair에서 check된 항목 load/save/remove
Compatibility Map에 적용
This commit is contained in:
180
Config.cs
180
Config.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace friction
|
||||
{
|
||||
public static class Config
|
||||
public class Config
|
||||
{
|
||||
public struct RANGE
|
||||
{
|
||||
@@ -17,8 +17,9 @@ namespace friction
|
||||
public float m_fHigh;
|
||||
}
|
||||
|
||||
private static Config m_instance = null;
|
||||
|
||||
static string m_strPath = "";
|
||||
string m_strPath = "";
|
||||
|
||||
public static readonly RANGE TEMP_ALL = new RANGE { m_fLow = -100.0f, m_fHigh = 100.0f };
|
||||
public static readonly RANGE TEMP_LOW = new RANGE { m_fLow = -100.0f, m_fHigh = 0.0f };
|
||||
@@ -29,12 +30,29 @@ namespace friction
|
||||
public static readonly RANGE HUMID_LOW = new RANGE { m_fLow = 0.0f, m_fHigh = 60.0f };
|
||||
public static readonly RANGE HUMID_HIGH = new RANGE { m_fLow = 60.0f, m_fHigh = 100.0f };
|
||||
|
||||
static Config()
|
||||
{
|
||||
|
||||
public class CheckedMaterial
|
||||
{
|
||||
public List<string> m_Springs = new List<string>();
|
||||
public List<string> m_Tables = new List<string>();
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
public Dictionary<string, CheckedMaterial> m_CheckedMaterial = new Dictionary<string, CheckedMaterial>();
|
||||
public string m_strCurMaterial = "";
|
||||
|
||||
private Config()
|
||||
{
|
||||
}
|
||||
|
||||
public static Config GetInstance()
|
||||
{
|
||||
if (m_instance == null)
|
||||
m_instance = new Config();
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
string strPrjName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
|
||||
string strFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), strPrjName);
|
||||
@@ -50,16 +68,60 @@ namespace friction
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
|
||||
|
||||
private static void Load()
|
||||
private CheckedMaterial LoadCheckedMaterial(string section)
|
||||
{
|
||||
CheckedMaterial cm = new CheckedMaterial();
|
||||
|
||||
StringBuilder temp = new StringBuilder(10240);
|
||||
int iRes = GetPrivateProfileString(section, "checked-spring", "", temp, 10240, m_strPath);
|
||||
if(temp.Length > 0)
|
||||
{
|
||||
string[] astrToken = temp.ToString().Split(',');
|
||||
cm.m_Springs = astrToken.ToList();
|
||||
}
|
||||
|
||||
iRes = GetPrivateProfileString(section, "checked-table", "", temp, 10240, m_strPath);
|
||||
if (temp.Length > 0)
|
||||
{
|
||||
string[] astrToken = temp.ToString().Split(',');
|
||||
cm.m_Tables = astrToken.ToList();
|
||||
}
|
||||
|
||||
return cm;
|
||||
}
|
||||
|
||||
public bool HasPref(string strName)
|
||||
{
|
||||
foreach(var pair in m_CheckedMaterial)
|
||||
{
|
||||
if (pair.Key == strName)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void InsertPref(string strName)
|
||||
{
|
||||
m_CheckedMaterial.Add(strName, new CheckedMaterial());
|
||||
}
|
||||
|
||||
public void RemovePref(string strName)
|
||||
{
|
||||
m_CheckedMaterial.Remove(strName);
|
||||
WritePrivateProfileString(strName, null, null, m_strPath);
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(10240);
|
||||
int iRes = GetPrivateProfileString("Option", "recent", "", temp, 10240, m_strPath);
|
||||
|
||||
if(temp.Length > 0)
|
||||
{
|
||||
string[] astrList = temp.ToString().Split(new string[] { "//" }, StringSplitOptions.None);
|
||||
string[] astrList = temp.ToString().Split(',');
|
||||
foreach (string strFile in astrList)
|
||||
OPTION.AddRecentFile(strFile);
|
||||
OPTION.GetInstance().AddRecentFile(strFile);
|
||||
}
|
||||
|
||||
iRes = GetPrivateProfileString("Option", "bound", "", temp, 10240, m_strPath);
|
||||
@@ -74,30 +136,82 @@ namespace friction
|
||||
int.TryParse(astrBound[2], out iTop);
|
||||
int.TryParse(astrBound[3], out iHeight);
|
||||
|
||||
OPTION.WindowBound = new Rectangle(iLeft, iTop, iWidth, iHeight);
|
||||
OPTION.GetInstance().WindowBound = new Rectangle(iLeft, iTop, iWidth, iHeight);
|
||||
}
|
||||
|
||||
iRes = GetPrivateProfileString("Option", "checked-column", "", temp, 10240, m_strPath);
|
||||
if (temp.Length > 0)
|
||||
{
|
||||
string[] astrBound = temp.ToString().Split(',');
|
||||
OPTION.CheckedColumns = astrBound.ToList();
|
||||
OPTION.GetInstance().CheckedColumns = astrBound.ToList();
|
||||
}
|
||||
|
||||
iRes = GetPrivateProfileString("Option", "unchecked-column", "", temp, 10240, m_strPath);
|
||||
if (temp.Length > 0)
|
||||
{
|
||||
string[] astrBound = temp.ToString().Split(',');
|
||||
OPTION.UncheckedColumns = astrBound.ToList();
|
||||
OPTION.GetInstance().UncheckedColumns = astrBound.ToList();
|
||||
}
|
||||
|
||||
iRes = GetPrivateProfileString("Option", "conf-names", "", temp, 10240, m_strPath);
|
||||
if (temp.Length > 0)
|
||||
{
|
||||
m_CheckedMaterial.Clear();
|
||||
|
||||
string[] astrSections = temp.ToString().Split(',');
|
||||
foreach(string section in astrSections)
|
||||
{
|
||||
CheckedMaterial cm = LoadCheckedMaterial(section);
|
||||
m_CheckedMaterial.Add(section, cm);
|
||||
}
|
||||
}
|
||||
|
||||
iRes = GetPrivateProfileString("Option", "current-conf", "", temp, 10240, m_strPath);
|
||||
if (temp.Length > 0)
|
||||
{
|
||||
m_strCurMaterial = temp.ToString();
|
||||
}
|
||||
|
||||
if(m_CheckedMaterial.Count == 0)
|
||||
{
|
||||
m_strCurMaterial = "Default";
|
||||
m_CheckedMaterial.Add(m_strCurMaterial, new CheckedMaterial());
|
||||
}
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
public void Save()
|
||||
{
|
||||
WritePrivateProfileString("Option", "recent", OPTION.GetRecentAll(), m_strPath);
|
||||
WritePrivateProfileString("Option", "bound", OPTION.WindowBoundStr(), m_strPath);
|
||||
WritePrivateProfileString("Option", "checked-column", OPTION.CheckedColumnsStr(), m_strPath);
|
||||
WritePrivateProfileString("Option", "unchecked-column", OPTION.UncheckedColumnsStr(), m_strPath);
|
||||
WritePrivateProfileString("Option", "recent", OPTION.GetInstance().GetRecentAll(), m_strPath);
|
||||
WritePrivateProfileString("Option", "bound", OPTION.GetInstance().WindowBoundStr(), m_strPath);
|
||||
WritePrivateProfileString("Option", "checked-column", OPTION.GetInstance().CheckedColumnsStr(), m_strPath);
|
||||
WritePrivateProfileString("Option", "unchecked-column", OPTION.GetInstance().UncheckedColumnsStr(), m_strPath);
|
||||
|
||||
foreach(var pair in m_CheckedMaterial)
|
||||
{
|
||||
WritePrivateProfileString(pair.Key, "checked-spring", string.Join(",", pair.Value.m_Springs.ToArray()), m_strPath);
|
||||
WritePrivateProfileString(pair.Key, "checked-table", string.Join(",", pair.Value.m_Tables.ToArray()), m_strPath);
|
||||
}
|
||||
WritePrivateProfileString("Option", "conf-names", string.Join(",", m_CheckedMaterial.Keys.ToArray()), m_strPath);
|
||||
WritePrivateProfileString("Option", "current-conf", m_strCurMaterial, m_strPath);
|
||||
}
|
||||
|
||||
public void SetSpringChecked(List<string> CheckedItems)
|
||||
{
|
||||
m_CheckedMaterial[m_strCurMaterial].m_Springs = CheckedItems;
|
||||
}
|
||||
|
||||
public List<string> GetSpringChecked()
|
||||
{
|
||||
return m_CheckedMaterial[m_strCurMaterial].m_Springs;
|
||||
}
|
||||
|
||||
public void SetTableChecked(List<string> CheckedItems)
|
||||
{
|
||||
m_CheckedMaterial[m_strCurMaterial].m_Tables = CheckedItems;
|
||||
}
|
||||
public List<string> GetTableChecked()
|
||||
{
|
||||
return m_CheckedMaterial[m_strCurMaterial].m_Tables;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,14 +227,24 @@ namespace friction
|
||||
}
|
||||
|
||||
|
||||
public static class OPTION
|
||||
public class OPTION
|
||||
{
|
||||
public static List<string> m_RecentList = new List<string>();
|
||||
public static Rectangle WindowBound { set; get; }
|
||||
public static List<string> CheckedColumns { set; get; }
|
||||
public static List<string> UncheckedColumns { set; get; }
|
||||
private static OPTION m_instance = null;
|
||||
|
||||
public static void AddRecentFile(string strPath)
|
||||
public List<string> m_RecentList = new List<string>();
|
||||
public Rectangle WindowBound { set; get; }
|
||||
public List<string> CheckedColumns { set; get; }
|
||||
public List<string> UncheckedColumns { set; get; }
|
||||
|
||||
public static OPTION GetInstance()
|
||||
{
|
||||
if (m_instance == null)
|
||||
m_instance = new OPTION();
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
public void AddRecentFile(string strPath)
|
||||
{
|
||||
if(m_RecentList.Find(s => s==strPath) != null)
|
||||
m_RecentList.Remove(strPath);
|
||||
@@ -128,17 +252,17 @@ namespace friction
|
||||
m_RecentList.Add(strPath);
|
||||
}
|
||||
|
||||
public static string GetRecentAll()
|
||||
public string GetRecentAll()
|
||||
{
|
||||
return string.Join("//", m_RecentList);
|
||||
}
|
||||
|
||||
public static string WindowBoundStr()
|
||||
public string WindowBoundStr()
|
||||
{
|
||||
return string.Format("{0}, {1}, {2}, {3}", WindowBound.Left, WindowBound.Width, WindowBound.Top, WindowBound.Height);
|
||||
}
|
||||
|
||||
public static string CheckedColumnsStr()
|
||||
public string CheckedColumnsStr()
|
||||
{
|
||||
string strResult = "";
|
||||
if(CheckedColumns != null)
|
||||
@@ -154,7 +278,7 @@ namespace friction
|
||||
return strResult;
|
||||
}
|
||||
|
||||
public static string UncheckedColumnsStr()
|
||||
public string UncheckedColumnsStr()
|
||||
{
|
||||
string strResult = "";
|
||||
|
||||
@@ -173,7 +297,7 @@ namespace friction
|
||||
}
|
||||
|
||||
|
||||
public static class ANALYSIS
|
||||
public class ANALYSIS
|
||||
{
|
||||
public enum RISK
|
||||
{
|
||||
@@ -211,8 +335,6 @@ namespace friction
|
||||
else
|
||||
return DEPENDANCY.HIGH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
46
MainForm.Designer.cs
generated
46
MainForm.Designer.cs
generated
@@ -56,6 +56,9 @@
|
||||
this.trendGraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.preferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator4 = new friction.ExtendedToolStripSeparator();
|
||||
this.aToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
|
||||
@@ -111,7 +114,7 @@
|
||||
this.toolStripButtonMaterial.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonMaterial.Image")));
|
||||
this.toolStripButtonMaterial.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonMaterial.Name = "toolStripButtonMaterial";
|
||||
this.toolStripButtonMaterial.Size = new System.Drawing.Size(23, 29);
|
||||
this.toolStripButtonMaterial.Size = new System.Drawing.Size(28, 29);
|
||||
this.toolStripButtonMaterial.Text = "toolStripButton1";
|
||||
this.toolStripButtonMaterial.ToolTipText = "Material Pair (Ctrl+M)";
|
||||
this.toolStripButtonMaterial.Click += new System.EventHandler(this.toolStripButtonMaterial_Click);
|
||||
@@ -127,7 +130,7 @@
|
||||
this.toolStripButtonResult.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonResult.Image")));
|
||||
this.toolStripButtonResult.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonResult.Name = "toolStripButtonResult";
|
||||
this.toolStripButtonResult.Size = new System.Drawing.Size(23, 29);
|
||||
this.toolStripButtonResult.Size = new System.Drawing.Size(28, 29);
|
||||
this.toolStripButtonResult.Text = "toolStripButton1";
|
||||
this.toolStripButtonResult.ToolTipText = "Result Table (Ctrl+R)";
|
||||
this.toolStripButtonResult.Click += new System.EventHandler(this.toolStripButtonResult_Click);
|
||||
@@ -138,7 +141,7 @@
|
||||
this.toolStripButtonAnalysis.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonAnalysis.Image")));
|
||||
this.toolStripButtonAnalysis.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonAnalysis.Name = "toolStripButtonAnalysis";
|
||||
this.toolStripButtonAnalysis.Size = new System.Drawing.Size(23, 29);
|
||||
this.toolStripButtonAnalysis.Size = new System.Drawing.Size(28, 29);
|
||||
this.toolStripButtonAnalysis.Text = "toolStripButton2";
|
||||
this.toolStripButtonAnalysis.ToolTipText = "Analysis Table (Ctrl+A)";
|
||||
this.toolStripButtonAnalysis.Click += new System.EventHandler(this.toolStripButtonAnalysis_Click);
|
||||
@@ -149,7 +152,7 @@
|
||||
this.toolStripButtonMap.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonMap.Image")));
|
||||
this.toolStripButtonMap.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonMap.Name = "toolStripButtonMap";
|
||||
this.toolStripButtonMap.Size = new System.Drawing.Size(23, 29);
|
||||
this.toolStripButtonMap.Size = new System.Drawing.Size(28, 29);
|
||||
this.toolStripButtonMap.Text = "toolStripButton1";
|
||||
this.toolStripButtonMap.ToolTipText = "Material Compatibility Map";
|
||||
this.toolStripButtonMap.Click += new System.EventHandler(this.toolStripButtonMap_Click);
|
||||
@@ -165,7 +168,7 @@
|
||||
this.toolStripButtonRadarGraph.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonRadarGraph.Image")));
|
||||
this.toolStripButtonRadarGraph.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonRadarGraph.Name = "toolStripButtonRadarGraph";
|
||||
this.toolStripButtonRadarGraph.Size = new System.Drawing.Size(23, 29);
|
||||
this.toolStripButtonRadarGraph.Size = new System.Drawing.Size(28, 29);
|
||||
this.toolStripButtonRadarGraph.Text = "toolStripButton3";
|
||||
this.toolStripButtonRadarGraph.ToolTipText = "Radar Graph (Ctrl+D)";
|
||||
this.toolStripButtonRadarGraph.Click += new System.EventHandler(this.toolStripButtonRadarGraph_Click);
|
||||
@@ -176,7 +179,7 @@
|
||||
this.toolStripButtonTrendGraph.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonTrendGraph.Image")));
|
||||
this.toolStripButtonTrendGraph.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonTrendGraph.Name = "toolStripButtonTrendGraph";
|
||||
this.toolStripButtonTrendGraph.Size = new System.Drawing.Size(23, 29);
|
||||
this.toolStripButtonTrendGraph.Size = new System.Drawing.Size(28, 29);
|
||||
this.toolStripButtonTrendGraph.Text = "toolStripButton4";
|
||||
this.toolStripButtonTrendGraph.ToolTipText = "Trend Graph (Ctrl+T)";
|
||||
this.toolStripButtonTrendGraph.Click += new System.EventHandler(this.toolStripButtonTrendGraph_Click);
|
||||
@@ -206,6 +209,7 @@
|
||||
this.tableToolStripMenuItem,
|
||||
this.graphToolStripMenuItem,
|
||||
this.reportToolStripMenuItem,
|
||||
this.preferenceToolStripMenuItem,
|
||||
this.aToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
@@ -226,20 +230,20 @@
|
||||
// openDBToolStripMenuItem
|
||||
//
|
||||
this.openDBToolStripMenuItem.Name = "openDBToolStripMenuItem";
|
||||
this.openDBToolStripMenuItem.Size = new System.Drawing.Size(152, 24);
|
||||
this.openDBToolStripMenuItem.Size = new System.Drawing.Size(141, 24);
|
||||
this.openDBToolStripMenuItem.Text = "Open DB";
|
||||
this.openDBToolStripMenuItem.Click += new System.EventHandler(this.openDBToolStripMenuItem_Click);
|
||||
//
|
||||
// recentToolStripMenuItem
|
||||
//
|
||||
this.recentToolStripMenuItem.Name = "recentToolStripMenuItem";
|
||||
this.recentToolStripMenuItem.Size = new System.Drawing.Size(152, 24);
|
||||
this.recentToolStripMenuItem.Size = new System.Drawing.Size(141, 24);
|
||||
this.recentToolStripMenuItem.Text = "Recent";
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 24);
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(141, 24);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -313,6 +317,27 @@
|
||||
this.allToolStripMenuItem.Text = "Export to Excel";
|
||||
this.allToolStripMenuItem.Click += new System.EventHandler(this.allToolStripMenuItem_Click);
|
||||
//
|
||||
// preferenceToolStripMenuItem
|
||||
//
|
||||
this.preferenceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.newToolStripMenuItem,
|
||||
this.toolStripSeparator4});
|
||||
this.preferenceToolStripMenuItem.Name = "preferenceToolStripMenuItem";
|
||||
this.preferenceToolStripMenuItem.Size = new System.Drawing.Size(93, 24);
|
||||
this.preferenceToolStripMenuItem.Text = "Preference";
|
||||
//
|
||||
// newToolStripMenuItem
|
||||
//
|
||||
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||
this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 24);
|
||||
this.newToolStripMenuItem.Text = "New";
|
||||
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// aToolStripMenuItem
|
||||
//
|
||||
this.aToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -395,6 +420,9 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonMap;
|
||||
private System.Windows.Forms.ToolStripMenuItem materialCompatibilityMapToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem preferenceToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
|
||||
private ExtendedToolStripSeparator toolStripSeparator4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
172
MainForm.cs
172
MainForm.cs
@@ -25,6 +25,8 @@ namespace friction
|
||||
|
||||
Report m_Report = null;
|
||||
|
||||
ToolStripMenuItem m_CurPref = null;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -37,24 +39,26 @@ namespace friction
|
||||
m_RadarGraphPanel = new PanelRadarGraph(this, m_DataHandler);
|
||||
m_TrendGraphPanel = new PanelTrendGraph(this, m_DataHandler);
|
||||
|
||||
Config.GetInstance().Init();
|
||||
UpdateRecentFile();
|
||||
UpdatePreference();
|
||||
if(Config.OPTION.GetInstance().WindowBound.Width > 0)
|
||||
Bounds = Config.OPTION.GetInstance().WindowBound;
|
||||
|
||||
|
||||
Theme.Apply(this);
|
||||
Theme.Apply(menuStrip);
|
||||
Theme.Apply(toolStripMain);
|
||||
Theme.Apply(statusStrip);
|
||||
|
||||
dockPanel.Font = new Font(dockPanel.Font.FontFamily, 12.0f);
|
||||
|
||||
Config.Init();
|
||||
UpdateRecentFile();
|
||||
if(Config.OPTION.WindowBound.Width > 0)
|
||||
Bounds = Config.OPTION.WindowBound;
|
||||
}
|
||||
|
||||
void UpdateRecentFile()
|
||||
{
|
||||
recentToolStripMenuItem.DropDownItems.Clear();
|
||||
|
||||
foreach (string file in Enumerable.Reverse(Config.OPTION.m_RecentList))
|
||||
foreach (string file in Enumerable.Reverse(Config.OPTION.GetInstance().m_RecentList))
|
||||
{
|
||||
ToolStripItem item = recentToolStripMenuItem.DropDownItems.Add(file);
|
||||
item.BackColor = Theme.Backcolor;
|
||||
@@ -69,6 +73,17 @@ namespace friction
|
||||
OpenDB(strFile);
|
||||
}
|
||||
|
||||
public void OnSpringCheckChanged(string strItem, bool bChecked)
|
||||
{
|
||||
m_CompatibilityPanel.SpringCheckChanged(strItem, bChecked);
|
||||
}
|
||||
|
||||
public void OnTableCheckChanged(string strItem, bool bChecked)
|
||||
{
|
||||
m_CompatibilityPanel.TableCheckChanged(strItem, bChecked);
|
||||
}
|
||||
|
||||
|
||||
private void OpenDB(string strFile=null)
|
||||
{
|
||||
if (strFile == null)
|
||||
@@ -111,8 +126,9 @@ namespace friction
|
||||
|
||||
toolStripStatusLabel.Text = m_DBFileName;
|
||||
|
||||
Config.OPTION.AddRecentFile(m_DBFileName);
|
||||
Config.OPTION.GetInstance().AddRecentFile(m_DBFileName);
|
||||
UpdateRecentFile();
|
||||
LoadPref(Config.GetInstance().m_strCurMaterial);
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@@ -375,10 +391,144 @@ namespace friction
|
||||
|
||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Config.OPTION.WindowBound = this.Bounds;
|
||||
Config.OPTION.CheckedColumns = m_ResultPanel.GetCheckedColumns();
|
||||
Config.OPTION.UncheckedColumns = m_ResultPanel.GetUncheckedColumns();
|
||||
Config.Save();
|
||||
Config.OPTION.GetInstance().WindowBound = this.Bounds;
|
||||
Config.OPTION.GetInstance().CheckedColumns = m_ResultPanel.GetCheckedColumns();
|
||||
Config.OPTION.GetInstance().UncheckedColumns = m_ResultPanel.GetUncheckedColumns();
|
||||
Config.GetInstance().Save();
|
||||
}
|
||||
|
||||
#region preference
|
||||
void UpdatePreference()
|
||||
{
|
||||
foreach (string pref in Config.GetInstance().m_CheckedMaterial.Keys)
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem(pref);
|
||||
ToolStripItem load = item.DropDownItems.Add("Load");
|
||||
load.Click += PreferenceLoadClick;
|
||||
ToolStripItem save = item.DropDownItems.Add("Save");
|
||||
save.Click += PreferenceSaveClick;
|
||||
if (pref != "Default")
|
||||
{
|
||||
ToolStripItem remove = item.DropDownItems.Add("Remove");
|
||||
remove.Click += PreferenceRemoveClick;
|
||||
}
|
||||
|
||||
preferenceToolStripMenuItem.DropDownItems.Add(item);
|
||||
|
||||
if (pref == Config.GetInstance().m_strCurMaterial)
|
||||
{
|
||||
item.Text = "ㆍ" + pref;
|
||||
m_CurPref = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectPref(string strPrefName)
|
||||
{
|
||||
foreach (ToolStripItem menuitem in preferenceToolStripMenuItem.DropDownItems)
|
||||
{
|
||||
if (menuitem.Text.StartsWith("ㆍ") == true)
|
||||
menuitem.Text = menuitem.Text.Substring("ㆍ".Length);
|
||||
|
||||
if (menuitem.Text == strPrefName)
|
||||
{
|
||||
menuitem.Text = "ㆍ" + menuitem.Text;
|
||||
m_CurPref = (ToolStripMenuItem)menuitem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadPref(string strPrefName)
|
||||
{
|
||||
Config.GetInstance().m_strCurMaterial = strPrefName;
|
||||
|
||||
m_MaterialPanel.LoadCheckedMaterial(strPrefName);
|
||||
m_CompatibilityPanel.SetMaterialChecked(strPrefName);
|
||||
|
||||
SelectPref(strPrefName);
|
||||
Config.GetInstance().Save();
|
||||
}
|
||||
|
||||
private void PreferenceLoadClick(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripItem item = (ToolStripItem)sender;
|
||||
ToolStripMenuItem parent = (ToolStripMenuItem)item.OwnerItem;
|
||||
string strPrefName = parent.Text;
|
||||
if (strPrefName.StartsWith("ㆍ"))
|
||||
strPrefName = strPrefName.Substring("ㆍ".Length);
|
||||
|
||||
LoadPref(strPrefName);
|
||||
}
|
||||
|
||||
private void PreferenceSaveClick(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripItem item = (ToolStripItem)sender;
|
||||
ToolStripMenuItem parent = (ToolStripMenuItem)item.OwnerItem;
|
||||
string strPrefName = parent.Text;
|
||||
if (strPrefName.StartsWith("ㆍ"))
|
||||
strPrefName = strPrefName.Substring("ㆍ".Length);
|
||||
Config.GetInstance().m_strCurMaterial = strPrefName;
|
||||
|
||||
m_MaterialPanel.SaveCheckedMaterial(strPrefName);
|
||||
|
||||
SelectPref(strPrefName);
|
||||
Config.GetInstance().Save();
|
||||
}
|
||||
|
||||
private void PreferenceRemoveClick(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripItem item = (ToolStripItem)sender;
|
||||
ToolStripMenuItem parent = (ToolStripMenuItem)item.OwnerItem;
|
||||
string strPrefName = parent.Text;
|
||||
if (strPrefName.StartsWith("ㆍ"))
|
||||
strPrefName = strPrefName.Substring("ㆍ".Length);
|
||||
|
||||
Config.GetInstance().RemovePref(strPrefName);
|
||||
preferenceToolStripMenuItem.DropDownItems.Remove(parent);
|
||||
|
||||
if (parent == m_CurPref)
|
||||
PreferenceLoadClick(((ToolStripMenuItem)preferenceToolStripMenuItem.DropDownItems[2]).DropDownItems[0], null);
|
||||
|
||||
Config.GetInstance().Save();
|
||||
}
|
||||
|
||||
private void newToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
NewPreference popup = new NewPreference(this);
|
||||
popup.Show();
|
||||
}
|
||||
|
||||
public void OnPreferenceAdd(string strName)
|
||||
{
|
||||
if(Config.GetInstance().HasPref(strName) == true)
|
||||
{
|
||||
MessageBox.Show("Preference name should be different from others.");
|
||||
NewPreference popup = new NewPreference(this);
|
||||
popup.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
Config.GetInstance().InsertPref(strName);
|
||||
Config.GetInstance().m_strCurMaterial = strName;
|
||||
|
||||
ToolStripMenuItem item = new ToolStripMenuItem(strName);
|
||||
ToolStripItem load = item.DropDownItems.Add("Load");
|
||||
load.Click += PreferenceLoadClick;
|
||||
ToolStripItem save = item.DropDownItems.Add("Save");
|
||||
save.Click += PreferenceSaveClick;
|
||||
ToolStripItem remove = item.DropDownItems.Add("Remove");
|
||||
save.Click += PreferenceRemoveClick;
|
||||
|
||||
preferenceToolStripMenuItem.DropDownItems.Add(item);
|
||||
|
||||
|
||||
if(m_CurPref != null)
|
||||
m_CurPref.Text = m_CurPref.Text.Substring("ㆍ".Length);
|
||||
m_CurPref = item;
|
||||
m_CurPref.Text = "ㆍ" + m_CurPref.Text;
|
||||
|
||||
Theme.Apply(menuStrip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,34 +167,34 @@
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAELSURBVDhPYxhcwH/7dgXv3ZsdoFwMAJIDqYFyMYHvzs0N
|
||||
vru2/IdyMQBIDqQGykUFKYuPvY9bfOBr/Pyjv0FsbDh28YFfyfMOfAOxodoQwHfi7v+kYKg2BGjff+N/
|
||||
vru2/IdyMQBIDqQGykUFKYuPvY9ZvP9r/Pyjv0FsbDh68b5fyXP2fQOxodoQwHfi7v+kYKg2BGjff+N/
|
||||
274b/1uBuBmIm/Ze/98IxPVAXLfn+v+aPdf+V+++9r8SiqHaEODw26//97z6+H/rs7f/QWwQDeJjEzvw
|
||||
9gt2AxovXv4PCqgtLz+D6aKzF7GKgdRCtSEASHD5wxf/W67cAtry5X/n1dv/Z917hlUMpwEzb9//n3vq
|
||||
FFhxwenT//tv3MMqhtOA9qvX/4fs2w12bhiQLrtwFasYTgNIwVBtCHD49WcHUjBU24ADBgYAKxuMHM+h
|
||||
n2IAAAAASUVORK5CYII=
|
||||
FFhxwenT//tv3MMqhtOA9qvX/4fs2w12bhiQLrtwFasYTgNIwVBtCHD49WcHUjBU24ADBgYAC0KMEbMo
|
||||
xeMAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripButtonRadarGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFbSURBVDhPYxh8wGfmJi6fSbtLfSfuPu88cffPyP27/hft
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFbSURBVDhPYxh8wGfmJi6fSbtLfSfuPu84cffPyP27/hft
|
||||
3/81a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3
|
||||
AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDQCFCVQK
|
||||
AUABhmwzVBgOQE6HGVB57tR/qDACIBvgNXHXFagwBPz/z7j8wZsfu199/r/1xaf/q5++xzTAu3/HOZgB
|
||||
AUABhmwzVBgOQE6HGVB57tR/qDACIBvgNXHXFagwBPz/z7j0wZsfu199/r/1xaf/q5++xzTAu3/HOZgB
|
||||
IOwzYVciVIqhfNP5tsNvv/6H4bV3Xn2BSiGAz8TdRcgGQPE1MJ6w+3/55otwA6adfrAWqg0BQnqPcYKc
|
||||
jmYAHHtP2PU/ffnJ/+uvvP5ef+IWH1QbKvCZsFsOnyFuvTtuJs3ZbwJVjh3Yz9/PAfHOrrO+/Ru/g/HE
|
||||
3WeA/AKQHFTZoAEMDAB+FD5H91aCSgAAAABJRU5ErkJggg==
|
||||
jmYAHHtP2PU/ffnJ/+svvf5ef+IWH1QbKvCZsFsOnyFuvTtuJs3ZbwJVjh3Yz9/PAfHOrrO+/eu/g/HE
|
||||
3WeA/AKQHFTZoAEMDABmSD45Ez7cuwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripButtonTrendGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEpSURBVDhPY6A7COk9xuk1Za88lIsdBE7bKeY7aac1lIsC
|
||||
/CbtXunbvvGfV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz
|
||||
D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNunc9Ov
|
||||
/CbtXunbuv6fV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz
|
||||
D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNunfdOv
|
||||
vDUnL4H45edO6FedPz0BxMYAB998DT785msOsiK/ybukAibte+IzcVc1iI/VALfeHULBk/ccb9595QCI
|
||||
j66o8vyZgKrzx6RBbKwGgELUeeLuv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB
|
||||
oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEA49D9S+nmzuwAAAAASUVORK5CYII=
|
||||
j66o8vyZgKrzx6RBbKwGgELUceLuv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB
|
||||
oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEAzSr9Q3GkmpEAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
||||
98
NewPreference.Designer.cs
generated
Normal file
98
NewPreference.Designer.cs
generated
Normal file
@@ -0,0 +1,98 @@
|
||||
namespace friction
|
||||
{
|
||||
partial class NewPreference
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tbName = new System.Windows.Forms.TextBox();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Location = new System.Drawing.Point(151, 75);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAdd.TabIndex = 0;
|
||||
this.btnAdd.Text = "Add";
|
||||
this.btnAdd.UseVisualStyleBackColor = true;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(34, 33);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(47, 12);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Name: ";
|
||||
//
|
||||
// tbName
|
||||
//
|
||||
this.tbName.Location = new System.Drawing.Point(87, 30);
|
||||
this.tbName.Name = "tbName";
|
||||
this.tbName.Size = new System.Drawing.Size(188, 21);
|
||||
this.tbName.TabIndex = 2;
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(232, 75);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 3;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// NewPreference
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(319, 106);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.tbName);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Name = "NewPreference";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "New Preference";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnAdd;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox tbName;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
}
|
||||
}
|
||||
45
NewPreference.cs
Normal file
45
NewPreference.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace friction
|
||||
{
|
||||
public partial class NewPreference : Form
|
||||
{
|
||||
MainForm m_Owner = null;
|
||||
|
||||
public NewPreference(MainForm owner)
|
||||
{
|
||||
m_Owner = owner;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this.AcceptButton = btnAdd;
|
||||
tbName.Select();
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (tbName.Text.Length == 0)
|
||||
{
|
||||
MessageBox.Show("Please enter new preference's name");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Owner.OnPreferenceAdd(tbName.Text);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
NewPreference.resx
Normal file
120
NewPreference.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -38,13 +38,81 @@ namespace friction
|
||||
|
||||
dgvMap.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False;
|
||||
dgvMap.RowHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False;
|
||||
|
||||
dgvMap.CellToolTipTextNeeded += DgvMap_CellToolTipTextNeeded;
|
||||
}
|
||||
|
||||
private void DgvMap_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
|
||||
public void SpringCheckChanged(string strItem, bool bChecked)
|
||||
{
|
||||
e.ToolTipText = "tooltip";
|
||||
if (dgvMap.Columns.Count <= 0)
|
||||
return;
|
||||
|
||||
if (dgvMap.Columns[0].HeaderText == "spring")
|
||||
{
|
||||
foreach(DataGridViewColumn col in dgvMap.Columns)
|
||||
{
|
||||
if(col.HeaderText == strItem)
|
||||
{
|
||||
col.Visible = bChecked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(DataGridViewRow row in dgvMap.Rows)
|
||||
{
|
||||
if((string)row.HeaderCell.Value == strItem)
|
||||
{
|
||||
row.Visible = bChecked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TableCheckChanged(string strItem, bool bChecked)
|
||||
{
|
||||
if (dgvMap.Columns.Count <= 0)
|
||||
return;
|
||||
|
||||
if (dgvMap.Columns[0].HeaderText == "table")
|
||||
{
|
||||
foreach (DataGridViewColumn col in dgvMap.Columns)
|
||||
{
|
||||
if (col.HeaderText == strItem)
|
||||
{
|
||||
col.Visible = bChecked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvMap.Rows)
|
||||
{
|
||||
if ((string)row.HeaderCell.Value == strItem)
|
||||
{
|
||||
row.Visible = bChecked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMaterialChecked(string strPrefName)
|
||||
{
|
||||
if (dgvMap.Columns.Count <= 0)
|
||||
return;
|
||||
|
||||
for (int i = 1; i < dgvMap.Columns.Count; i++)
|
||||
dgvMap.Columns[i].Visible = false;
|
||||
for (int i = 1; i < dgvMap.Rows.Count-1; i++)
|
||||
dgvMap.Rows[i].Visible = false;
|
||||
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
foreach (string item in cm.m_Springs)
|
||||
SpringCheckChanged(item, true);
|
||||
foreach (string item in cm.m_Tables)
|
||||
TableCheckChanged(item, true);
|
||||
}
|
||||
|
||||
public void UpdateData()
|
||||
@@ -118,9 +186,7 @@ namespace friction
|
||||
dt.Columns.Add(" ");
|
||||
foreach (DataGridViewColumn column in dgvMap.Columns)
|
||||
{
|
||||
if (column.Visible)
|
||||
dt.Columns.Add(column.HeaderText);
|
||||
|
||||
dt.Columns.Add(column.HeaderText);
|
||||
ColumnHeaders.Add(column.HeaderText);
|
||||
}
|
||||
|
||||
@@ -215,6 +281,7 @@ namespace friction
|
||||
private void btPivot_Click(object sender, EventArgs e)
|
||||
{
|
||||
Pivot();
|
||||
SetMaterialChecked(Config.GetInstance().m_strCurMaterial);
|
||||
}
|
||||
|
||||
private void dgvMap_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
|
||||
@@ -71,6 +71,65 @@ namespace friction
|
||||
Theme.ResizeFullColumn(lvTable);
|
||||
}
|
||||
|
||||
public void LoadCheckedMaterial(string strPrefName)
|
||||
{
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
|
||||
foreach(ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
foreach(string strSpring in cm.m_Springs)
|
||||
{
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
if(item.Text == strSpring)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
foreach (string strTable in cm.m_Tables)
|
||||
{
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
if (item.Text == strTable)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveCheckedMaterial(string strPrefName)
|
||||
{
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
|
||||
cm.m_Springs.Clear();
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
if (item.Checked == true)
|
||||
cm.m_Springs.Add(item.Text);
|
||||
}
|
||||
|
||||
cm.m_Tables.Clear();
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
if (item.Checked == true)
|
||||
cm.m_Tables.Add(item.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectSpring(int iIdx)
|
||||
{
|
||||
if (m_SelectedSpring != null)
|
||||
@@ -141,6 +200,23 @@ namespace friction
|
||||
if (view == lvTable && e.Item.Text == "All")
|
||||
e.Item.Checked = true;
|
||||
|
||||
List<string> CheckedItems = new List<string>();
|
||||
foreach(ListViewItem item in view.CheckedItems)
|
||||
{
|
||||
CheckedItems.Add(item.Text);
|
||||
}
|
||||
|
||||
if(view == lvSpring)
|
||||
m_Owner.OnSpringCheckChanged(e.Item.Text, e.Item.Checked);
|
||||
else
|
||||
m_Owner.OnTableCheckChanged(e.Item.Text, e.Item.Checked);
|
||||
|
||||
//if (view == lvTable)
|
||||
// Config.GetInstance().SetTableChecked(CheckedItems);
|
||||
//else
|
||||
// Config.GetInstance().SetSpringChecked(CheckedItems);
|
||||
|
||||
|
||||
view.Sort();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace friction
|
||||
|
||||
if(lvColumn.Items.Count > 0)
|
||||
{
|
||||
Config.OPTION.CheckedColumns = GetCheckedColumns();
|
||||
Config.OPTION.UncheckedColumns = GetUncheckedColumns();
|
||||
Config.OPTION.GetInstance().CheckedColumns = GetCheckedColumns();
|
||||
Config.OPTION.GetInstance().UncheckedColumns = GetUncheckedColumns();
|
||||
}
|
||||
|
||||
lvColumn.Items.Clear();
|
||||
@@ -63,9 +63,9 @@ namespace friction
|
||||
ListViewItem item = new ListViewItem(new string[] { col });
|
||||
item.Text = col;
|
||||
|
||||
if(Config.OPTION.CheckedColumns != null && Config.OPTION.CheckedColumns.Exists(s => s==col) == true)
|
||||
if(Config.OPTION.GetInstance().CheckedColumns != null && Config.OPTION.GetInstance().CheckedColumns.Exists(s => s==col) == true)
|
||||
item.Checked = true;
|
||||
else if(Config.OPTION.UncheckedColumns != null && Config.OPTION.UncheckedColumns.Exists(s => s == col) == true)
|
||||
else if(Config.OPTION.GetInstance().UncheckedColumns != null && Config.OPTION.GetInstance().UncheckedColumns.Exists(s => s == col) == true)
|
||||
item.Checked = false;
|
||||
else if (iGroup == 0)
|
||||
item.Checked = true;
|
||||
|
||||
47
Theme.cs
47
Theme.cs
@@ -167,8 +167,25 @@ namespace friction
|
||||
|
||||
foreach (ToolStripMenuItem item in ctrl.Items)
|
||||
{
|
||||
foreach (ToolStripMenuItem subitem in item.DropDownItems)
|
||||
foreach (ToolStripItem subitem in item.DropDownItems)
|
||||
{
|
||||
if(subitem.GetType() == typeof(ToolStripMenuItem))
|
||||
{
|
||||
foreach (ToolStripItem subsubitem in ((ToolStripMenuItem)subitem).DropDownItems)
|
||||
{
|
||||
subsubitem.BackColor = Backcolor;
|
||||
subsubitem.ForeColor = Forecolor;
|
||||
|
||||
subsubitem.MouseEnter += Ctrl_MouseEnter;
|
||||
subsubitem.MouseLeave += Ctrl_MouseLeave;
|
||||
}
|
||||
}
|
||||
else if(subitem.GetType() == typeof(ToolStripSeparator))
|
||||
{
|
||||
((ToolStripSeparator)subitem).BackColor = Backcolor;
|
||||
((ToolStripSeparator)subitem).ForeColor = Forecolor;
|
||||
}
|
||||
|
||||
subitem.BackColor = Backcolor;
|
||||
subitem.ForeColor = Forecolor;
|
||||
|
||||
@@ -202,4 +219,32 @@ namespace friction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ExtendedToolStripSeparator : ToolStripSeparator
|
||||
{
|
||||
public ExtendedToolStripSeparator()
|
||||
{
|
||||
this.Paint += ExtendedToolStripSeparator_Paint;
|
||||
}
|
||||
|
||||
private void ExtendedToolStripSeparator_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
// Get the separator's width and height.
|
||||
ToolStripSeparator toolStripSeparator = (ToolStripSeparator)sender;
|
||||
int width = toolStripSeparator.Width;
|
||||
int height = toolStripSeparator.Height;
|
||||
|
||||
// Choose the colors for drawing.
|
||||
// I've used Color.White as the foreColor.
|
||||
Color foreColor = Theme.Forecolor;
|
||||
// Color.Teal as the backColor.
|
||||
Color backColor = Theme.Backcolor;
|
||||
|
||||
// Fill the background.
|
||||
e.Graphics.FillRectangle(new SolidBrush(backColor), 0, 0, width, height);
|
||||
|
||||
// Draw the line.
|
||||
e.Graphics.DrawLine(new Pen(foreColor), 4, height / 2, width - 4, height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,12 @@
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NewPreference.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="NewPreference.Designer.cs">
|
||||
<DependentUpon>NewPreference.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PanelAnalysis.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -133,6 +139,9 @@
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="NewPreference.resx">
|
||||
<DependentUpon>NewPreference.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PanelAnalysis.resx">
|
||||
<DependentUpon>PanelAnalysis.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user