Beispiel #1
0
        // ショートカットキーの設定
        private void ListViewShortcut_KeyUp(object sender, KeyEventArgs e)
        {
            if (ListViewShortcut.SelectedItems.Count <= 0)
            {
                return;
            }

            if (e.KeyCode == Keys.Enter)
            {
                if (IsEntered)
                {
                    IsEntered = false;
                }
                else
                {
                    ListViewHitInfo = ListViewShortcut.HitTest(ListViewShortcut.SelectedItems[0].Position);
                    if (ListViewHitInfo.SubItem != null)
                    {
                        Dll.SetKeyboardHook(true);
                        HotKey                     = new HotKeyInfo();
                        ListViewInput              = new ListViewInputBox(ListViewShortcut, ListViewHitInfo.Item, 1);
                        ListViewInput.FinishInput += new ListViewInputBox.InputEventHandler(Input_FinishInput);
                        ListViewInput.Disposed    += new EventHandler(Input_Disposed);
                        ListViewInput.Show();
                    }
                }
            }
            else if (e.KeyCode == Keys.Delete)
            {
                ListViewShortcut.SelectedItems[0].SubItems[1].Text = "";
                GHManager.TempSettings.Hotkey.HotKeys[(int)ListViewShortcut.SelectedItems[0].Tag].SetKeys(0, 0);
            }
        }
Beispiel #2
0
 /// <summary>
 /// ランチャーが終了する時のイベント (後処理)
 /// </summary>
 private void Launcher_FormClosing(object sender, FormClosingEventArgs e)
 {
     // フックを解除
     Dll.EndHook();
     MysetManager.SaveMyset();
     GHManager.SaveSetting();
     GHManager.UnregistHotKey(Handle);
 }
Beispiel #3
0
        private void Config_Sub_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(255);

            WinAPI.GetClassName(Handle, sb, 255);
            Dll.SetSubConfigClassName(sb.ToString().ToCharArray());

            UpDownRight.Value  = RefPadding.Right;
            UpDownTop.Value    = RefPadding.Top;
            UpDownLeft.Value   = RefPadding.Left;
            UpDownBottom.Value = RefPadding.Bottom;
        }
Beispiel #4
0
 // ショートカットキーの設定
 private void ListViewShortcut_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     ListViewHitInfo = ListViewShortcut.HitTest(e.X, e.Y);
     if (ListViewHitInfo.SubItem != null && e.Button == MouseButtons.Left)
     {
         Dll.SetKeyboardHook(true);
         HotKey                     = new HotKeyInfo();
         ListViewInput              = new ListViewInputBox(ListViewShortcut, ListViewHitInfo.Item, 1);
         ListViewInput.FinishInput += new ListViewInputBox.InputEventHandler(Input_FinishInput);
         ListViewInput.Disposed    += new EventHandler(Input_Disposed);
         ListViewInput.Show();
     }
 }
Beispiel #5
0
        // ショートカットキー入力の確定
        public bool Input_FinishInput(object sender, ListViewInputBox.InputEventArgs e)
        {
            Dll.SetKeyboardHook(false);

            if (ListViewHitInfo != null && ListViewHitInfo.SubItem != null)
            {
                int        index = ListViewHitInfo.Item.Index;
                List <int> col   = new List <int> {
                    index
                };

                if (PrevKeyStr[(int)ListViewHitInfo.Item.Tag] != e.NewName)
                {
                    if (!GHManager.CheckRegistHotKey(e.HotKey.ModKey, e.HotKey.Key))
                    {
                        col.Add(index);
                    }
                }

                foreach (var item in GHManager.TempSettings.Hotkey.HotKeys.Select((kv, i) => new { kv, i }))
                {
                    ListViewShortcut.Items[item.i].ForeColor = Color.FromKnownColor(KnownColor.WindowText);
                    if ((int)ListViewHitInfo.Item.Tag == item.kv.Key)
                    {
                        continue;
                    }
                    if (e.HotKey.Equals(item.kv.Value))
                    {
                        col.Add(item.i);
                    }
                }

                if (col.Count > 1)
                {
                    col.ForEach(i => ListViewShortcut.Items[i].ForeColor = Color.Red);
                }

                ListViewHitInfo.Item.SubItems[1].Text = e.NewName;
                GHManager.TempSettings.Hotkey.HotKeys[(int)ListViewHitInfo.Item.Tag].SetKeys(e.HotKey.ModKey, e.HotKey.Key);
            }
            else
            {
                return(false);
            }

            HotKey = null;
            return(true);
        }
Beispiel #6
0
        /// <summary>
        /// ランチャーの読み込み時のイベント
        /// </summary>
        private void Launcher_Load(object sender, EventArgs e)
        {
            // タスクトレイに追加
            AddNotifyIcon();

            // マイセットアイコンの初期化&追加
            MysetIcon = new GHIconEx(SkinImage.Myset_Open_Icon, SkinImage.Myset_Icon, FormType.Launcher);
            MysetIcon.control.MouseClick += (s, a) => {
                if (a.Button == MouseButtons.Left)
                {
                    if (GHManager.MysetList.FormVisible)
                    {
                        GHManager.MysetList.MouseActive = false;
                        GHManager.MysetList.MysetList_Hide();
                    }
                    else
                    {
                        GHManager.MysetList.MouseActive = true;
                        GHManager.MysetList.MysetList_Show();
                    }
                }
            };
            Controls.Add(MysetIcon.control);

            // フック開始
            if (!Dll.StartHook())
            {
                Application.Exit();
            }

            // ランチャーの位置・サイズを設定
            Size = new Size(GHManager.Settings.Style.Launcher.Width, GHManager.Settings.Style.Launcher.Height);
            SetOffset(GHManager.Settings.Launcher.Offset);

            animateInfo = new GHAnimateInfo(GHManager.Settings.Animate.Launcher_DelayTime, GHManager.Settings.Animate.Launcher_AnimateTime, GHManager.Settings.Animate.Launcher_Slide, GHManager.Settings.Animate.Launcher_Fade);

            GHManager.RegistHotKey(Handle);
            // タイマー開始
            DrawTimer.Start();
            UpdateTimer.Start();
        }
Beispiel #7
0
 private void MenuItem_ResetDLL_Click(object sender, EventArgs e)
 {
     Dll.EndHook();
     Dll.StartHook();
 }
Beispiel #8
0
        private void Config_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(255);

            WinAPI.GetClassName(Handle, sb, 255);
            Dll.SetConfigClassName(sb.ToString().ToCharArray());
            Dll.SetConfigText(Text.ToCharArray());

            ConfigTabControl.SelectedIndex = Page;

            BringToFront();
            ComboBoxLauncherPos.Select();
            Activate();

            KeysMap.Init();

            // 現在の設定を退避
            GHManager.SavePoint(1);

            // コントロールに現在の設定を設定
            // ランチャーページ
            ComboBoxLauncherPos.SelectedIndex = (int)GHManager.Settings.Launcher.Pos;
            UpDownLauncherReactRange.Value    = GHManager.Settings.Launcher.ReactRange;
            CheckLauncherMouseButton.Checked  = GHManager.Settings.Launcher.ShownMouseButton;
            UpDownLauncherDelayTime.Value     = GHManager.Settings.Animate.Launcher_DelayTime;
            UpDownLauncherAnimateTime.Value   = GHManager.Settings.Animate.Launcher_AnimateTime;
            CheckLauncherSlide.Checked        = GHManager.Settings.Animate.Launcher_Slide;
            CheckLauncherFade.Checked         = GHManager.Settings.Animate.Launcher_Fade;
            UpDownMysetlistDelayTime.Value    = GHManager.Settings.Animate.MysetList_DelayTime;
            UpDownMysetlistAnimateTime.Value  = GHManager.Settings.Animate.MysetList_AnimateTime;
            CheckMysetlistSlide.Checked       = GHManager.Settings.Animate.MysetList_Slide;
            CheckMysetlistFade.Checked        = GHManager.Settings.Animate.MysetList_Fade;
            UpDownItemlistDelayTime.Value     = GHManager.Settings.Animate.ItemList_DelayTime;
            UpDownItemlistAnimateTime.Value   = GHManager.Settings.Animate.ItemList_AnimateTime;
            CheckItemlistSlide.Checked        = GHManager.Settings.Animate.ItemList_Slide;
            CheckItemlistFade.Checked         = GHManager.Settings.Animate.ItemList_Fade;

            // キーボードページ
            Dictionary <int, string> ShortcutStrMap = new Dictionary <int, string> {
                { GH_SHID.Show, "表示" },
                { GH_SHID.Hide, "非表示" },
                { GH_SHID.ShowConfig, "設定を表示" },
                { GH_SHID.OpenSelectItem, "選択項目を実行" },
                { GH_SHID.DeleteSelectItem, "選択項目を削除" },
                { GH_SHID.SelectNextItem, "次の項目を選択" },
                { GH_SHID.SelectPrevItem, "前の項目を選択" },
                { GH_SHID.SelectNextGroup, "次のグループを選択" },
                { GH_SHID.SelectPrevGroup, "前のグループを選択" },
                { GH_SHID.SelectGroupTile, "グループのウィンドウを左右に並べて表示" },
                { GH_SHID.SelectGroupTile2, "グループのウィンドウを上下に並べて表示" }
            };

            foreach (var item in GHManager.Settings.Hotkey.HotKeys.Select((kv, i) => new { kv, i }))
            {
                if (item.i > ListViewShortcut.Items.Count)
                {
                    break;
                }
                string keystr = KeysToString(item.kv.Value.ModKey, item.kv.Value.Key);
                ListViewShortcut.Items[item.i].SubItems[1].Text = keystr;
                ListViewShortcut.Items[item.i].Tag  = item.kv.Key;
                ListViewShortcut.Items[item.i].Text = ShortcutStrMap[item.kv.Key];
                PrevKeyStr.Add(item.kv.Key, keystr);
            }

            Dictionary <uint, string> wpKeyMap = new Dictionary <uint, string> {
                { (uint)Keys.Menu, "Alt" },
                { (uint)Keys.ControlKey, "Ctrl" },
                { (uint)Keys.ShiftKey, "Shift" }
            };

            uint[] key = new uint[2] {
                (uint)Keys.ShiftKey, (uint)Keys.ControlKey
            };
            if (wpKeyMap.ContainsKey(GHManager.TempSettings.Magnet.GroupKey))
            {
                key[0] = GHManager.TempSettings.Magnet.GroupKey;
            }
            if (wpKeyMap.ContainsKey(GHManager.TempSettings.Magnet.MoveKey))
            {
                key[1] = GHManager.TempSettings.Magnet.MoveKey;
            }
            ((RadioButton)PanelGroup.Controls["RadioButtonGroup" + wpKeyMap[key[0]]]).Checked = true;
            ((RadioButton)PanelMove.Controls["RadioButtonMove" + wpKeyMap[key[0]]]).Enabled   = false;
            ((RadioButton)PanelGroup.Controls["RadioButtonGroup" + wpKeyMap[key[1]]]).Enabled = false;
            ((RadioButton)PanelMove.Controls["RadioButtonMove" + wpKeyMap[key[1]]]).Checked   = true;

            // マグネットページ
            TrackBarFitRange.Value  = GHManager.Settings.Magnet.FitRange;
            LabelFitRange.Text      = TrackBarFitRange.Value.ToString() + "px";
            CheckFitScreen.Checked  = GHManager.Settings.Magnet.FitDisplay;
            CheckFitTaskbar.Checked = GHManager.Settings.Magnet.FitTaskbar;
            CheckFitWindow.Checked  = GHManager.Settings.Magnet.FitWindows;

            //Dll.GetNoFitWindows(GHManager.settings.Magnet.NoFitWindows, 255);

            long[] arr = new long[255];

            Dll.GetAllWindows(arr);
            StringBuilder windowText = new StringBuilder(255);
            StringBuilder className  = new StringBuilder(255);

            for (int i = 0; i < 255; ++i)
            {
                if (WinAPI.GetWindowText((IntPtr)arr[i], windowText, 255) != 0 && WinAPI.GetClassName((IntPtr)arr[i], className, 255) != 0)
                {
                    ListBoxWindows.Items.Add("[" + i.ToString("000") + "] [class:" + className.ToString() + "] [caption:" + windowText.ToString() + "]");
                }
            }

            //for(int i = 0; i < 255; ++i) {
            //	if (GHManager.settings.Magnet.NoFitWindows[i].classname != "" &&
            //		GHManager.settings.Magnet.NoFitWindows[i].text != "") {
            //		ListBoxNoFitWindows.Items.Add("[" + i.ToString("000") + "] [class:" + GHManager.settings.Magnet.NoFitWindows[i].classname + "] [caption:" + GHManager.settings.Magnet.NoFitWindows[i].text + "]");
            //	}
            //}

            // スタイルページ
            UpDownLauncherItemSize.Value    = GHManager.Settings.Style.Launcher.ItemSize;
            UpDownLauncherItemSpace.Value   = GHManager.Settings.Style.Launcher.ItemSpace;
            ComboBoxGroupIcon.SelectedIndex = GHManager.Settings.GroupIconStyle;

            UpDownMysetItemSize.Value       = GHManager.Settings.Style.MysetList.ItemSize;
            UpDownMysetItemSpace.Value      = GHManager.Settings.Style.MysetList.ItemSpace;
            ComboBoxMysetIcon.SelectedIndex = GHManager.Settings.MysetIconStyle;

            UpDownItemListItemSizeHeight.Value = GHManager.Settings.Style.ItemList.ItemSizeHeight;
            UpDownItemListItemSizeWidth.Value  = GHManager.Settings.Style.ItemList.ItemSizeWidth;
            UpDownItemListItemSpace.Value      = GHManager.Settings.Style.ItemList.ItemSpace;
            UpDownItemList_Column.Value        = GHManager.Settings.Style.ItemList.Column;
            UpDownItemListIconSize.Value       = GHManager.Settings.Style.ItemList.IconSize;
            ComboboxUseIconSize.Text           = GHManager.Settings.Style.ItemList.GetUseIconSize().ToString();

            ComboBoxDrawQuality.SelectedIndex = GHManager.Settings.DrawQuality;
            Load_Skin();
        }