OSDN Git Service

no message
authorwagashi <wagashi@users.sourceforge.jp>
Mon, 15 Nov 2010 17:59:12 +0000 (02:59 +0900)
committerwagashi <wagashi@users.sourceforge.jp>
Mon, 15 Nov 2010 17:59:12 +0000 (02:59 +0900)
passer/AddEngineForm.cs
passer/EditEngineForm.cs
passer/MainForm.cs
passer/MainFormEvent.cs
passer/Passer.csproj
passer/Passer.suo
passer/ProgramEngine.cs

index c8110e9..a2a2669 100644 (file)
@@ -44,7 +44,7 @@ namespace Lugens.Passer
 
         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)
                 {
@@ -66,7 +66,7 @@ namespace Lugens.Passer
                 }
             }
             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)
index 27e3d14..a9d3caf 100644 (file)
@@ -48,7 +48,7 @@ namespace Lugens.Passer
 
         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)
                 {
@@ -70,7 +70,7 @@ namespace Lugens.Passer
                 }
             }
             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)
index 4e4288c..22a6ad8 100644 (file)
@@ -88,7 +88,7 @@ namespace Lugens.Passer
         /// <summary>
         /// 現在選択中の検索エンジン
         /// </summary>
-        private int SelectedEngineIndex;
+        public int SelectedEngineIndex;
 
         /// <summary>
         /// 現在選択中の検索エンジンタイプ
@@ -628,7 +628,7 @@ namespace Lugens.Passer
                 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
index ab5296f..d6be45c 100644 (file)
@@ -359,9 +359,12 @@ namespace Lugens.Passer
 
         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;
index b44efb9..c102299 100644 (file)
     <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" />
index 112940d..e6645e4 100644 (file)
Binary files a/passer/Passer.suo and b/passer/Passer.suo differ
index 912eb6c..c8b3aed 100644 (file)
@@ -88,9 +88,8 @@ namespace Lugens.Passer
 
         /// <summary>
         /// ホットキー押下時の検索エンジンリスト
-        /// StructHotKeyProcess or List
         /// </summary>
-        public static Dictionary<int, EngineInfo> HotKeyEngineDic = new Dictionary<int, EngineInfo>();
+        public static List<int> HotKeyEngineList = new List<int>();
 
         /// <summary>
         /// 検索エンジンのアイコン用テンポラリディレクトリ作成
@@ -147,6 +146,39 @@ namespace Lugens.Passer
             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>
@@ -288,8 +320,8 @@ namespace Lugens.Passer
 
                             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);
                         }
                     }
                 }
@@ -372,7 +404,7 @@ namespace Lugens.Passer
         {
             Program.DefaultEngineList.Clear();
             Program.DefaultEngineDic.Clear();
-            Program.HotKeyEngineDic.Clear();
+            Program.HotKeyEngineList.Clear();
             EngineInfo info = new EngineInfo();
             info.Id = "0001";
             info.Name = "Passer";
@@ -382,7 +414,7 @@ namespace Lugens.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);
 
         }