OSDN Git Service

no message
[passer/Passer2.git] / passer / MainFormEvent.cs
1 /**
2  * $Revision: 238 $
3  * $Date: 2010-03-18 20:45:05 +0900 (木, 18 3 2010) $
4 */
5
6 using System;
7 using System.Collections.Generic;
8 using System.Diagnostics;
9 using System.Drawing;
10 using System.IO;
11 using System.Text;
12 using System.Windows.Forms;
13 using System.Web;
14 using System.Net;
15 using Lugens.Components;
16 using Lugens.Utils;
17 using System.Runtime.InteropServices;
18 using Newtonsoft.Json;
19
20 namespace Lugens.Passer
21 {
22     public partial class MainForm
23     {
24
25         private void DoResize(int width)
26         {
27             Size size = this.Size;
28             size.Width = width;
29             if (size.Width < 200)
30                 size.Width = 200;
31             else if (size.Width > 600)
32                 size.Width = 600;
33
34             Settings.Set(Settings.PASSER_FORM_MAIN_WIDTH, size.Width);
35
36             this.Size = size;
37             size.Width -= 16;
38             size.Height = this.searchTextBox.Size.Height;
39             this.searchTextBox.Size = size;
40             if (this.searchTextBox.TextBox.DropdownForm.Visible)
41                 this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
42
43             //リージョン設定
44             //IntPtr hRgn = Win32.CreateRoundRectRgn(0, 0, this.Size.Width, this.Size.Height, 6, 6);
45             //Win32.SetWindowRgn(this.Handle, hRgn, true);
46
47         
48         }
49
50         private void MainForm_MouseDown(object sender, MouseEventArgs e)
51         {
52             if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
53             {
54                 this.mousePoint = new Point(-e.X, -e.Y);
55                 this.windowMoveFlag = true;
56             }
57         }
58
59         private void MainForm_MouseMove(object sender, MouseEventArgs e)
60         {
61             if (this.Cursor == Cursors.SizeWE && (e.Button & MouseButtons.Left) == MouseButtons.Left)
62             {
63                 //ウィンドウの幅変更
64                 this.DoResize(e.X);
65             }
66             else if (this.windowMoveFlag && (e.Button & MouseButtons.Left) == MouseButtons.Left)
67             {
68                 //ウィンドウの移動
69                 this.seenPoint = new Point(this.Left + mousePoint.X + e.X, this.Top + mousePoint.Y + e.Y);
70                 this.Location = this.seenPoint;
71
72                 Settings.Set(Settings.PASSER_FORM_MAIN_X, this.seenPoint.X);
73                 Settings.Set(Settings.PASSER_FORM_MAIN_Y, this.seenPoint.Y);
74
75                 if (this.searchTextBox.TextBox.DropdownForm.Visible)
76                     this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
77             }
78             else if (e.X >= (this.Size.Width - 4))
79             {
80                 //幅変更カーソルに変更
81                 this.Cursor = Cursors.SizeWE;
82             }
83             else
84             {
85                 //標準カーソルに変更
86                 if (this.Cursor == Cursors.SizeWE)
87                     this.Cursor = Cursors.Default;
88             }
89         }
90
91         private void MainForm_MouseUp(object sender, MouseEventArgs e)
92         {
93             this.windowMoveFlag = false;
94         }
95
96         private void MainForm_Load(object sender, System.EventArgs e)
97         {
98             this.Visible = false;
99             this.Size = new Size(256, 32);
100             this.Location = this.seenPoint;
101             ReadCommandList();
102             this.searchTextBox.TextBox.DropdownForm.DrawType = Lugens.Components.DropdownListForm.DrawMode.IconText;
103             this.searchTextBox.TextBox.DropdownForm.IconCallBack = this.GetIconCallBack;
104             this.searchTextBox.TextBox.DropdownForm.VisibleChanged += this.dropdownListBox_SelectedIndexChanged;
105             this.searchTextBox.TextBox.DropdownForm.DropdownListBox.SelectedIndexChanged += this.dropdownListBox_SelectedIndexChanged;
106             this.searchTextBox.TextBox.DropdownForm.DropdownListBox.VisibleChanged += this.dropdownListBox_SelectedIndexChanged;
107             this.Activated += this.dropdownListBox_SelectedIndexChanged;
108             this.AddOwnedForm(this.searchTextBox.TextBox.DropdownForm);
109         }
110
111         private void ShowDropdownForm(bool filter)
112         {
113             switch (this.SelectedEngineType)
114             {
115                 case 0: //Passer
116                 case 1: //FileSearch
117                     this.SetDropdownList(filter);
118                     if (this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Count > 0)
119                     {
120                         this.searchTextBox.TextBox.DropdownForm.DropdownListBox.SelectedIndex = 0;
121                         this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(true);
122                     }
123                     break;
124
125                 case 2: //WebSearch
126                     if(String.IsNullOrEmpty(this.searchTextBox.TextBox.Text))
127                         this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
128                     else
129                         this.SetEngineDropdownList();
130                     break;
131             }
132         }
133
134         private void SetDropdownList()
135         {
136             this.SetDropdownList(true);
137         }
138
139         private void SetRootDriveList()
140         {
141             Program.RootDriveList.Clear();
142             foreach (DriveInfo d in DriveInfo.GetDrives())
143             {
144                 IconListViewItem item = new IconListViewItem();
145                 item.Name = d.Name;
146                 item.Text = d.Name;
147                 item.Type = IconListViewType.Directory;
148                 switch (d.DriveType)
149                 {
150                     case DriveType.Fixed:
151                         if (Environment.SystemDirectory.StartsWith(d.Name))
152                             item.Icon = Properties.Resources.IconDriveWin;
153                         else
154                             item.Icon = Properties.Resources.IconDriveFix;
155                         break;
156                     case DriveType.Network:
157                         item.Icon = Properties.Resources.IconDriveNet;
158                         break;
159                     case DriveType.CDRom:
160                         item.Icon = Properties.Resources.IconDriveCD;
161                         break;
162                     case DriveType.Removable:
163                         item.Icon = Properties.Resources.IconDriveRem;
164                         break;
165                     default:
166                         item.Icon = Properties.Resources.IconDriveFix;
167                         break;
168                 }
169                 Program.RootDriveList.Add(item);
170                 this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(item);
171             }
172         }
173
174         private void SetDropdownList(bool filter)
175         {
176             string[] commands = Program.ParseCommand(this.searchTextBox.TextBox.Text);
177             string command = "";
178             if(commands.Length > 0)
179                 command = commands[commands.Length - 1];
180
181             this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Clear();
182             if (filter && command.Equals(""))
183             {
184                 this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
185                 return;
186             }
187
188 //            if ("c:\\".Equals(command))
189 //            {
190 //                //command = command;
191 //            }
192
193             if (!command.Equals("") && command[0] == '\\')
194             {
195 /*
196                 if (command.Length == 1)
197                 {
198                     this.SetRootDriveList();
199                 }
200                 else if (command.LastIndexOf('\\') == 0)
201                 {
202                     //ルートドライブ
203                     string str = command.Substring(1);
204                     foreach (ListViewItem item in Program.RootDriveList)
205                     {
206                         if (this.textBox_cmd.CaseSensitive)
207                         {
208                             if (item.Text.StartsWith(str))
209                                 this.textBox_cmd.DropdownForm.DropdownListView.Items.Add(item);
210                         }
211                         else
212                         {
213                             if (item.Text.ToLower().StartsWith(str.ToLower()))
214                                 this.textBox_cmd.DropdownForm.DropdownListView.Items.Add(item);
215                         }
216                     }
217                 } */
218             }
219             else if (!command.Equals("") && command[0] == '!')
220             {
221                 if (command.Length == 1)
222                 {
223                     foreach (string str in Program.CommandHistoryList)
224                     {
225                         IconListBoxItem item = new IconListBoxItem();
226                         item.Name = str;
227                         item.Text = str;
228                         item.Type = IconListBoxType.History;
229                         item.IconImage = Properties.Resources.IconHistory.ToBitmap();
230                         this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(item);
231                     }
232                 }
233                 else
234                 {
235                     foreach (string str in Program.CommandHistoryList)
236                     {
237                         string text = command.Substring(1);
238                         //if (item.Text.ToLower().StartsWith(this.textBox_cmd.Text.ToLower()) || Program.Ime.StartsWith(item.Regex, this.textBox_cmd.Text))
239
240                         if (str.ToLower().StartsWith(text.ToLower()))
241                         {
242                             IconListBoxItem item = new IconListBoxItem();
243                             item.Name = str;
244                             item.Text = str;
245                             item.Type = IconListBoxType.History;
246                             item.IconImage = Properties.Resources.IconHistory.ToBitmap();
247                             this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(item);
248                         }
249                     }
250                 }
251
252             }
253             else
254             {
255                 int lindex = command.LastIndexOf('\\') + 1;
256                 if (lindex > 0)
257                 {
258                     string directories = command.Substring(0, lindex);
259                     string files = command.Substring(lindex);
260
261                     try
262                     {
263                         if (Directory.GetFileSystemEntries(directories, files + "*").Length > 0)
264                         {
265                             this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Clear();
266                             if (this.searchTextBox.TextBox.Text.Equals(Directory.GetDirectoryRoot(command)))
267                             {
268                                 DriveInfo driveInfo = new DriveInfo(this.searchTextBox.TextBox.Text[0].ToString());
269                                 if (!driveInfo.IsReady)
270                                     return;
271                             }
272                             foreach (string directory in Directory.GetDirectories(directories, files + "*"))
273                             {
274                                 IconListBoxItem item = new IconListBoxItem();
275                                 item.Name = directory.Substring(directories.Length) + "\\";
276                                 item.Text = directory + "\\";
277                                 item.Type = IconListBoxType.Directory;
278                                 item.IconImage = Program.DirectoryIcon.ToBitmap();
279                                 this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(item);
280                             }
281                             foreach (string file in Directory.GetFiles(directories, files + "*"))
282                             {
283                                 int extindex;
284                                 string ext;
285                                 IconListBoxItem item = new IconListBoxItem();
286                                 item.Name = file.Substring(directories.Length);
287                                 item.Text = file;
288                                 item.Type = IconListBoxType.Directory;
289
290                                 extindex = item.Name.LastIndexOf('.');
291                                 ext = extindex == -1 ? "" : item.Name.Substring(extindex + 1);
292
293                                 if ("exe".Equals(ext) || "lnk".Equals(ext))
294                                 {
295                                     Win32.SHFILEINFO shinfo = new Win32.SHFILEINFO();
296                                     Win32.SHGetFileInfo(file, 0, ref shinfo, Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
297                                     if (shinfo.hIcon != IntPtr.Zero)
298                                         item.IconImage = System.Drawing.Icon.FromHandle(shinfo.hIcon).ToBitmap();
299                                 }
300                                 else
301                                 {
302                                     if (Program.ExtIconCacheDic.ContainsKey(ext))
303                                     {
304                                         if (Program.ExtIconCacheDic[ext] != null)
305                                             item.IconImage = Program.ExtIconCacheDic[ext].ToBitmap();
306                                     }
307                                     else
308                                     {
309                                         Win32.SHFILEINFO shinfo = new Win32.SHFILEINFO();
310                                         Win32.SHGetFileInfo(file, 0, ref shinfo, Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
311                                         if (shinfo.hIcon != IntPtr.Zero)
312                                         {
313                                             Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
314                                             Program.ExtIconCacheDic.Add(ext, icon);
315                                             item.IconImage = icon.ToBitmap();
316                                         }
317                                         else
318                                         {
319                                             Program.ExtIconCacheDic.Add(ext, null);
320                                         }
321                                     }
322                                 }
323                                 this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(item);
324                             }
325                         }
326                     }
327                     catch { }
328                 }
329                 else
330                 {
331                     foreach (IconListBoxItem item in this.searchTextBox.TextBox.Items)
332                     {
333                         if (item.Text.ToLower().StartsWith(this.searchTextBox.TextBox.Text.ToLower()) || Program.Ime.StartsWith(item.Regex, this.searchTextBox.TextBox.Text))
334                             this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(item);
335                     }
336                     if (command.Length > 0)
337                     {
338                         foreach (string str in Program.CommandHistoryList)
339                         {
340                             if (str.StartsWith(command))
341                             {
342                                 bool exist = false;
343                                 foreach (IconListBoxItem item in this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items)
344                                 {
345                                     if (str.Equals(item.Text))
346                                     {
347                                         exist = true;
348                                         break;
349                                     }
350                                 }
351
352                                 if (exist)
353                                     continue;
354                                 IconListBoxItem i = new IconListBoxItem();
355                                 i.Name = str;
356                                 i.Text = str;
357                                 i.Type = IconListBoxType.History;
358                                 i.IconImage = null;
359                                 this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Add(i);
360                             }
361                         }
362                     }
363
364                 }
365             }
366             if (this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Count == 0)
367             {
368                 this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
369                 return;
370             }
371             this.searchTextBox.TextBox.SetDropdownFormLocation();
372         }
373
374         /// <summary>
375         /// 検索エンジンのサジェスト
376         /// </summary>
377         public void SetEngineDropdownList()
378         {
379             string url = "http://suggestqueries.google.com/complete/search?client=firefox&q=" + HttpUtility.UrlEncode(this.searchTextBox.TextBox.Text);
380             WebRequest webReq = HttpWebRequest.Create(url);
381             webReq.Method = "GET";
382             webReq.ContentType = "application/x-www-form-urlencoded";
383
384             AsyncCallback readCallBack = new AsyncCallback(SuggestReadCallBack);
385             webReq.BeginGetResponse(readCallBack, webReq);
386
387         }
388
389         private void SuggestReadCallBack(IAsyncResult ar)
390         {
391             HttpWebRequest req = (HttpWebRequest)ar.AsyncState;
392             HttpWebResponse response = (HttpWebResponse)req.EndGetResponse(ar);
393             StreamReader streamReader = new StreamReader(response.GetResponseStream());
394             string str = streamReader.ReadToEnd();
395             streamReader.Close();
396             List<string> list = new List<string>();
397             using (StringReader stringReader = new StringReader(str))
398             {
399                 using (JsonReader jsonReader = new JsonTextReader(stringReader))
400                 {
401                     while (jsonReader.Read())
402                     {
403                         if (jsonReader.TokenType == JsonToken.String)
404                             list.Add(jsonReader.Value.ToString());
405                     }
406                 }
407             }
408             Win32.PostMessage(Program.MainFormHandle, Program.WM_SUGGEST_END, IntPtr.Zero, Marshal.StringToHGlobalAuto(str));
409         }
410
411         private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
412         {
413             if (Program.HotKeyEngineList.Contains(KeyboardHook.Keycode))
414             {
415                 EngineInfo info = Program.GetEngineInfoFromHotKey(KeyboardHook.Keycode);
416                 if (info == null)
417                     return;
418
419                 this.SetSearchEngine(info);
420                 e.Handled = true;
421                 return;
422             }
423
424             switch ((Keys)e.KeyChar)
425             {
426                 case Keys.Tab:
427                     e.Handled = true;
428                     if (this.SearchTextBox.TextBox.Complemented)
429                         return;
430
431                     if (!this.SearchTextBox.TextBox.DropdownForm.Visible)
432                     {
433                         this.ShowDropdownForm(false);
434                         return;
435                     }
436                     break;
437
438                 case Keys.Space:
439                     if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
440                     {
441                         if (this.SearchTextBox.TextBox.ShowableDropdownList)
442                             this.ShowDropdownForm(false);
443                         e.Handled = true;
444                     }
445                     break;
446
447                 case Keys.Enter:
448                     string command = this.SearchTextBox.TextBox.Text.Trim();
449                     switch (this.SelectedEngineType)
450                     {
451                         case 0: //COMMAND
452                             if (this.ExecCommand(command))
453                             {
454                                 Program.AddHistoryList(command);
455                             }
456                             break;
457
458                         case 1: //FILE_VIEW
459                             break;
460
461                         case 2: //WEB_SEARCH
462                             this.ExecSearch(command);
463                             break;
464                     }
465                     e.Handled = true;
466                     return;
467
468                 case Keys.Escape:
469                     if (this.SearchTextBox.TextBox.DropdownForm.Visible)
470                     {
471                         this.SearchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
472                         Program.HideToolTip();
473                         e.Handled = true;
474                         return;
475                     }
476                     if (!"".Equals(searchTextBox.TextBox.Text))
477                     {
478                         this.SearchTextBox.TextBox.Text = "";
479                         this.SearchTextBox.TextBox.SelectionStart = 0;
480                         e.Handled = true;
481                         return;
482                     }
483                     if(this.Visible)
484                     {
485                         this.DoVisibleChange(false);
486                         Program.ForceForegroundWindow(this.beforeHWnd);
487                     }
488                     e.Handled = true;
489                     return;
490             }
491         }
492
493         private void textBox_cmd_KeyDown(object sender, KeyEventArgs e)
494         {
495             if (Program.MainForm.Opacity != Program.FormOpacity)
496                 Program.MainForm.Opacity = Program.FormOpacity;
497
498             switch (e.KeyCode)
499             {
500                 case Keys.Up:
501                     if ((Keys.Control & Control.ModifierKeys) == Keys.Control)
502                     {
503                         //検索エンジンの切替
504                         this.SelectedEngineIndex--;
505                         if(this.SelectedEngineIndex == -1)
506                             this.SelectedEngineIndex = Program.DefaultEngineList.Count + Program.EngineList.Count - 1;
507                         this.SetSearchEngine(Program.GetEngineInfo(this.SelectedEngineIndex));
508                     }
509                     else
510                     {
511                         if (!this.SearchTextBox.TextBox.DropdownForm.Visible)
512                         {
513                             if (Program.CommandHistoryList.Count > 0)
514                             {
515                                 if (Program.CommandHistoryList.Count > Program.CommandHistoryIndex)
516                                     Program.CommandHistoryIndex++;
517                                 this.showDropdownSupport = false;
518                                 this.SearchTextBox.TextBox.Text = Program.CommandHistoryList[Program.CommandHistoryIndex - 1];
519                                 this.SearchTextBox.TextBox.SelectionStart = this.SearchTextBox.TextBox.Text.Length;
520                                 this.showDropdownSupport = true;
521                             }
522                         }
523                     }
524                     break;
525
526                 case Keys.Down:
527                     if ((Keys.Control & Control.ModifierKeys) == Keys.Control)
528                     {
529                         //検索エンジンの切替
530                         this.SelectedEngineIndex++;
531                         int count = Program.DefaultEngineList.Count + Program.EngineList.Count;
532                         if (this.SelectedEngineIndex == count)
533                             this.SelectedEngineIndex = 0;
534                         this.SetSearchEngine(Program.GetEngineInfo(this.SelectedEngineIndex));
535                     }
536                     else
537                     {
538                         if (!this.SearchTextBox.TextBox.DropdownForm.Visible)
539                         {
540                             if (Program.CommandHistoryIndex > 0)
541                             {
542                                 Program.CommandHistoryIndex--;
543                                 this.showDropdownSupport = false;
544                                 if (Program.CommandHistoryIndex == 0)
545                                     this.SearchTextBox.TextBox.Text = "";
546                                 else
547                                     this.SearchTextBox.TextBox.Text = Program.CommandHistoryList[Program.CommandHistoryIndex - 1];
548                                 this.SearchTextBox.TextBox.SelectionStart = this.SearchTextBox.TextBox.Text.Length;
549                                 this.showDropdownSupport = true;
550                             }
551                             else
552                             {
553                                 this.ShowDropdownForm(false);
554                             }
555                         }
556                     }
557                     break;
558             }
559         }
560         
561         private void textBox_cmd_TextChanged(object sender, EventArgs e)
562         {
563             if (!this.showDropdownSupport)
564                 return;
565
566             Size s = TextRenderer.MeasureText(this.searchTextBox.TextBox.Text, this.searchTextBox.TextBox.Font);
567             if (s.Width > this.searchTextBox.TextBox.Width)
568             {
569                 //MessageBox.Show("!!!");
570             }
571
572             if(!this.searchTextBox.TextBox.Complemented)
573                 this.ShowDropdownForm(true);
574         }
575
576         private void textBox_cmd_Complement(IconListBoxType type)
577         {
578             //this.ShowFileList();
579         }
580
581         private void dropdownListBox_SelectedIndexChanged(object sender, EventArgs e)
582         {
583             Program.HideToolTip();
584             if (!this.searchTextBox.TextBox.DropdownForm.Visible)
585                 return;
586
587             IconListBox listBox = this.searchTextBox.TextBox.DropdownForm.DropdownListBox;
588
589             string text = listBox.Text;
590             if (text.Equals(this.dropdownListBoxText))
591                 return;
592
593             if (!(text.StartsWith(":") || Program.CommandDic.ContainsKey(text)))
594                 return;
595
596             int lastIndex = listBox.ClientRectangle.Height / listBox.ItemHeight;
597             if (listBox.TopIndex > listBox.SelectedIndex || (listBox.TopIndex + lastIndex) <= listBox.SelectedIndex)
598                 return;
599
600             IconListBoxItem item = (IconListBoxItem)listBox.SelectedItem;
601             DropdownListForm dropdownForm = this.searchTextBox.TextBox.DropdownForm;
602
603             Rectangle r = dropdownForm.Bounds;
604             r.Y = dropdownForm.Location.Y + listBox.GetItemRectangle(listBox.SelectedIndex).Y;
605             if (item.ToolTipText == null || item.ToolTipText.Length == 0)
606             {
607                 CommandInfo info = Program.CommandDic[text];
608                 text = info.Comment == null ? info.Name : info.Comment;
609             }
610             else
611             {
612                 text = item.ToolTipText;
613             }
614             Program.ShowToolTip(Util.CutText(text, 50, 10), r, 5000, false);
615         }
616
617         private void timer1_Tick(object sender, System.EventArgs e)
618         {
619             if (this.Visible)
620             {
621                 if (this.Opacity + Program.FadeInSpeed < Program.FormOpacity)
622                 {
623                     this.Opacity += Program.FadeInSpeed;
624                     this.searchTextBox.TextBox.DropdownForm.Opacity = this.Opacity;
625                     this.Update();
626                 }
627                 else
628                 {
629                     this.Opacity = Program.FormOpacity;
630                     this.searchTextBox.TextBox.DropdownForm.Opacity = this.Opacity;
631                     this.timer1.Stop();
632                 }
633             }
634         }
635
636         private void timer_keyRecoding_Tick(object sender, EventArgs e)
637         {
638             if (Program.Status == ProgramStatus.KeyRecoding && Program.Main_ShowBalloonWhileRecoding && Program.BallonWindowHandle != IntPtr.Zero)
639                 Win32.PostMessage(Program.BallonWindowHandle, Win32.WM_MOUSEMOVE, (IntPtr)0, (IntPtr)0);
640         }
641
642         private void toolTip_Popup(object sender, PopupEventArgs e)
643         {
644        
645         }
646
647         private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
648         {
649             if (e.Button == MouseButtons.Left)
650             {
651                 switch (Program.Status)
652                 {
653                     case ProgramStatus.Loading:
654                     case ProgramStatus.Waiting:
655                     case ProgramStatus.MainFormOpen:
656                         HotKeyProcessExecuter.OpenMainForm();
657                         break;
658                 }
659             }
660         }
661
662         private void DropdownListView_MouseDoubleClick(object sender, MouseEventArgs e)
663         {
664             this.searchTextBox.TextBox.Text = this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Text;
665             this.searchTextBox.TextBox.Select(this.searchTextBox.TextBox.Text.Length, 0);
666             this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
667         }
668
669         private void 表示ToolStripMenuItem_Click(object sender, EventArgs e)
670         {
671             switch (Program.Status)
672             {
673                 case ProgramStatus.Loading:
674                 case ProgramStatus.Waiting:
675                 case ProgramStatus.MainFormOpen:
676                     HotKeyProcessExecuter.OpenMainForm();
677                     break;
678             }
679         }
680
681         private void リスト設定ToolStripMenuItem_Click(object sender, EventArgs e)
682         {
683             if (!Program.SettingForm.Visible)
684             {
685                 this.DoVisibleChange(false);
686                 Program.SettingForm.DoVisibleChange(true);
687             }
688         }
689
690         private void バージョン情報ToolStripMenuItem_Click(object sender, EventArgs e)
691         {
692             if (Program.Status == ProgramStatus.Waiting)
693             {
694                 Program.Status = ProgramStatus.VersionFormOpen;
695                 VersionForm f = new VersionForm();
696                 f.ShowDialog();
697                 Program.Status = ProgramStatus.Waiting;
698             }
699         }
700
701         private void 終了ToolStripMenuItem_Click(object sender, EventArgs e)
702         {
703             this.Close();
704             Application.Exit();
705         }
706     }
707 }