From 78fca7733bcef3874502dd28cd9be55c93d6ad85 Mon Sep 17 00:00:00 2001 From: yumetodo Date: Fri, 1 Apr 2016 13:30:24 +0900 Subject: [PATCH] =?UTF-8?q?#102=20=E8=B5=B7=E5=8B=95=E7=9B=B4=E5=BE=8C?= =?UTF-8?q?=E3=81=AF=E6=96=B0=E8=A6=8F=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92?= =?UTF-8?q?=E6=8A=BC=E3=81=97=E3=81=9F=E5=BE=8C=E3=81=A8=E5=90=8C=E3=81=98?= =?UTF-8?q?=E7=8A=B6=E6=85=8B=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KCS_GUI/Form1.Designer.cs | 17 ++++++------ KCS_GUI/Form1.cs | 56 +++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/KCS_GUI/Form1.Designer.cs b/KCS_GUI/Form1.Designer.cs index bdf7935..52741e6 100644 --- a/KCS_GUI/Form1.Designer.cs +++ b/KCS_GUI/Form1.Designer.cs @@ -132,10 +132,10 @@ private void InitializeComponent() this.SaveAFileMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ヘルプHToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ShowHelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.VersionInfoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.filename_echo = new System.Windows.Forms.ToolStripStatusLabel(); - this.ShowHelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainTabControl.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -1432,7 +1432,7 @@ private void InitializeComponent() this.NewFileMenuItem.Name = "NewFileMenuItem"; this.NewFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); this.NewFileMenuItem.Size = new System.Drawing.Size(286, 22); - this.NewFileMenuItem.Text = "新規(&N)"; + this.NewFileMenuItem.Text = "リセット(&N)"; this.NewFileMenuItem.Click += new System.EventHandler(this.NewFileMenuItem_Click); // // OpenFileMenuItem @@ -1477,6 +1477,13 @@ private void InitializeComponent() this.ヘルプHToolStripMenuItem.Size = new System.Drawing.Size(75, 22); this.ヘルプHToolStripMenuItem.Text = "ヘルプ(&H)"; // + // ShowHelpToolStripMenuItem + // + this.ShowHelpToolStripMenuItem.Name = "ShowHelpToolStripMenuItem"; + this.ShowHelpToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.ShowHelpToolStripMenuItem.Text = "ヘルプの表示(&V)"; + this.ShowHelpToolStripMenuItem.Click += new System.EventHandler(this.ShowHelpToolStripMenuItem_Click); + // // VersionInfoMenuItem // this.VersionInfoMenuItem.Name = "VersionInfoMenuItem"; @@ -1501,12 +1508,6 @@ private void InitializeComponent() this.filename_echo.Name = "filename_echo"; this.filename_echo.Size = new System.Drawing.Size(70, 18); this.filename_echo.Text = "filename..."; - // ShowHelpToolStripMenuItem - // - this.ShowHelpToolStripMenuItem.Name = "ShowHelpToolStripMenuItem"; - this.ShowHelpToolStripMenuItem.Size = new System.Drawing.Size(158, 22); - this.ShowHelpToolStripMenuItem.Text = "ヘルプの表示(&V)"; - this.ShowHelpToolStripMenuItem.Click += new System.EventHandler(this.ShowHelpToolStripMenuItem_Click); // // MainForm // diff --git a/KCS_GUI/Form1.cs b/KCS_GUI/Form1.cs index 27f57a2..e8f0c09 100644 --- a/KCS_GUI/Form1.cs +++ b/KCS_GUI/Form1.cs @@ -115,9 +115,12 @@ public MainForm() { FormMapData = new MapData(); file = new OpenFileInfo[2] { - new OpenFileInfo(), - new OpenFileInfo() + new OpenFileInfo("untitled.json", FileState.new_created), + new OpenFileInfo("untitled.map", FileState.new_created) }; + if (IsInRange(MainTabControl.SelectedIndex, 0, 1)) { + OpenFileInfoToStatusBar(this.file[MainTabControl.SelectedIndex]); + } error_provider_level = new System.Windows.Forms.ErrorProvider(); error_provider_luck = new System.Windows.Forms.ErrorProvider(); error_provider_cond = new System.Windows.Forms.ErrorProvider(); @@ -128,28 +131,15 @@ public MainForm() { } /* 各イベント毎の処理 */ + private void OpenFileInfoToStatusBar(OpenFileInfo info) { + this.filename_echo.ForeColor = (FileState.none != info.state) ? SystemColors.ControlText : SystemColors.GradientInactiveCaption; + this.filename_echo.BackColor = info.bg_color; + this.filename_echo.Text = info.name; + } private void file_state_modified(FileState new_state) { if (IsInRange(MainTabControl.SelectedIndex, 0, 1)) { - this.file[MainTabControl.SelectedIndex].state = new_state; - this.filename_echo.ForeColor = (FileState.none != new_state) ? SystemColors.ControlText : SystemColors.GradientInactiveCaption; - switch (new_state) { - case FileState.none: - this.filename_echo.BackColor = SystemColors.Control; - this.file[MainTabControl.SelectedIndex].name = this.filename_echo.Text = "filename..."; - break; - case FileState.new_created: - this.filename_echo.BackColor = SystemColors.Info; - break; - case FileState.modified: - this.filename_echo.BackColor = Color.FromArgb(253, 239, 242); - break; - case FileState.saved: - this.filename_echo.BackColor = Color.FromArgb(235, 246, 247); - break; - default: - break; - } - this.file[MainTabControl.SelectedIndex].bg_color = this.filename_echo.BackColor; + this.file[MainTabControl.SelectedIndex].UpdateState(new_state); + OpenFileInfoToStatusBar(this.file[MainTabControl.SelectedIndex]); } } private void file_state_modified(string filename, FileState new_state) { @@ -1672,8 +1662,28 @@ public OpenFileInfo() { this.bg_color = SystemColors.Control; } public OpenFileInfo(string name_, FileState state_) { + this.UpdateState(state_); this.name = name_; - this.state = state_; + } + public void UpdateState(FileState new_state) { + this.state = new_state; + switch (new_state) { + case FileState.none: + this.bg_color = SystemColors.Control; + this.name = "filename..."; + break; + case FileState.new_created: + this.bg_color = SystemColors.Info; + break; + case FileState.modified: + this.bg_color = Color.FromArgb(253, 239, 242); + break; + case FileState.saved: + this.bg_color = Color.FromArgb(235, 246, 247); + break; + default: + break; + } } public string name; public FileState state;