private void textBox_shortcut_TextChanged(object sender, EventArgs e)
{
- if (this.textBox_shortcut.HotKeycode != 0)
+ /* if (this.textBox_shortcut.HotKeycode != 0)
{
foreach (EngineInfo info in Program.DefaultEngineDic.Values)
{
}
}
this.label_shortcut_duplicate.Visible = false;
- this.button_ok.Enabled = true;
+ this.button_ok.Enabled = true;*/
}
private void button_ok_Click(object sender, EventArgs e)
private void textBox_shortcut_TextChanged(object sender, EventArgs e)
{
- if (this.textBox_shortcut.HotKeycode != 0)
+/* if (this.textBox_shortcut.HotKeycode != 0)
{
foreach (EngineInfo info in Program.DefaultEngineDic.Values)
{
}
}
this.label_shortcut_duplicate.Visible = false;
- this.button_ok.Enabled = true;
+ this.button_ok.Enabled = true;*/
}
private void button_ok_Click(object sender, EventArgs e)
/// <summary>
/// 現在選択中の検索エンジン
/// </summary>
- private int SelectedEngineIndex;
+ public int SelectedEngineIndex;
/// <summary>
/// 現在選択中の検索エンジンタイプ
this.DoResize(Settings.GetInt(Settings.PASSER_FORM_MAIN_WIDTH));
this.searchTextBox.TextBox.SelectionStart = 0;
this.searchTextBox.TextBox.ShowableDropdownList = true;
- this.SetSearchEngine(Program.HotKeyEngineDic[4176]);
+ this.SetSearchEngine(Program.GetEngineInfo(0));
this.timer1.Start();
}
else
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
- if (Program.HotKeyEngineDic.ContainsKey(KeyboardHook.Keycode))
+ if (Program.HotKeyEngineList.Contains(KeyboardHook.Keycode))
{
- EngineInfo info = Program.HotKeyEngineDic[KeyboardHook.Keycode];
+ EngineInfo info = Program.GetEngineInfoFromHotKey(KeyboardHook.Keycode);
+ if (info == null)
+ return;
+
this.SetSearchEngine(info);
e.Handled = true;
return;
<Compile Include="AddEngineForm.Designer.cs">
<DependentUpon>AddEngineForm.cs</DependentUpon>
</Compile>
+ <Compile Include="EditEngineForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="EditEngineForm.Designer.cs">
+ <DependentUpon>EditEngineForm.cs</DependentUpon>
+ </Compile>
<EmbeddedResource Include="AddCommandForm.resx">
<SubType>Designer</SubType>
<DependentUpon>AddCommandForm.cs</DependentUpon>
<DependentUpon>AddEngineForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="EditEngineForm.resx">
+ <DependentUpon>EditEngineForm.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<None Include="app.config" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<Content Include="Resources\App.ico" />
<Content Include="Resources\AppRec.ico" />
<Content Include="Resources\cd_drive.ico" />
+ <Content Include="Resources\default_engine.ico" />
<Content Include="Resources\desktop.ico" />
<Content Include="Resources\document.ico" />
+ <Content Include="Resources\passer_search.ico" />
<Content Include="Resources\fix_drive.ico" />
<Content Include="Resources\history.ico" />
<Content Include="Resources\hold.png" />
<Content Include="Resources\loading.gif" />
<Content Include="Resources\net_drive.ico" />
- <Content Include="Resources\engine_command.bmp" />
<Content Include="Resources\passer_engine.ico" />
<Content Include="Resources\rem_drive.ico" />
<Content Include="Resources\script.ico" />
/// <summary>
/// ホットキー押下時の検索エンジンリスト
- /// StructHotKeyProcess or List
/// </summary>
- public static Dictionary<int, EngineInfo> HotKeyEngineDic = new Dictionary<int, EngineInfo>();
+ public static List<int> HotKeyEngineList = new List<int>();
/// <summary>
/// 検索エンジンのアイコン用テンポラリディレクトリ作成
return null;
}
+ public static EngineInfo GetEngineInfoFromHotKey(int hotkey)
+ {
+ if (!Program.HotKeyEngineList.Contains(hotkey))
+ return null;
+
+ int index;
+ int sindex = Program.MainForm.SelectedEngineIndex;
+ int dcount = Program.DefaultEngineList.Count;
+ int count = dcount + Program.EngineList.Count;
+ EngineInfo info;
+ for (int i = 1; i < count; i++)
+ {
+ index = sindex + i;
+ if (index >= count)
+ index -= count;
+
+ if (index < dcount)
+ {
+ info = Program.DefaultEngineDic[Program.DefaultEngineList[index]];
+ if (info.Shortcut == hotkey)
+ return info;
+ }
+ else
+ {
+ index -= dcount;
+ info = Program.EngineDic[Program.EngineList[index]];
+ if (info.Shortcut == hotkey)
+ return info;
+ }
+ }
+ return null;
+ }
+
/// <summary>
/// 検索エンジンの一意IDを作成
/// </summary>
Program.EngineList.Add(info.Name);
Program.EngineDic.Add(info.Name, info);
- if(info.Shortcut > 0)
- Program.HotKeyEngineDic.Add(info.Shortcut, info);
+ if(info.Shortcut > 0 && !Program.HotKeyEngineList.Contains(info.Shortcut))
+ Program.HotKeyEngineList.Add(info.Shortcut);
}
}
}
{
Program.DefaultEngineList.Clear();
Program.DefaultEngineDic.Clear();
- Program.HotKeyEngineDic.Clear();
+ Program.HotKeyEngineList.Clear();
EngineInfo info = new EngineInfo();
info.Id = "0001";
info.Name = "Passer";
info.Display = "コマンドを入力してください";
Program.DefaultEngineList.Add(info.Name);
Program.DefaultEngineDic.Add(info.Name, info);
- Program.HotKeyEngineDic.Add(info.Shortcut, info);
+ Program.HotKeyEngineList.Add(info.Shortcut);
}