コード例 #1
0
ファイル: MainForm.cs プロジェクト: downspade/milligram
        private void DisplayBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (ShowingList == false)
            {
                MainForm_KeyDown(sender, e);
                return;
            }

            if (Locked)
            {
                return;
            }

            int SubKey = 0;

            if (((Win32.GetAsyncKeyState(Win32.EVirtualKey.VK_LSHIFT) & 0x8000) | (Win32.GetAsyncKeyState(Win32.EVirtualKey.VK_RSHIFT) & 0x8000)) != 0)
            {
                SubKey |= 1;
            }

            if (((Win32.GetAsyncKeyState(Win32.EVirtualKey.VK_LCONTROL) & 0x8000) | (Win32.GetAsyncKeyState(Win32.EVirtualKey.VK_RCONTROL) & 0x8000)) != 0)
            {
                SubKey |= 2;
            }

            if (((Win32.GetAsyncKeyState(Win32.EVirtualKey.VK_LMENU) & 0x8000) | (Win32.GetAsyncKeyState(Win32.EVirtualKey.VK_RMENU) & 0x8000)) != 0)
            {
                SubKey |= 4;
            }

            switch (e.KeyCode)
            {
            case Keys.Space:
                if (SubKey == 2)
                {
                    MnToggleShow_Click(null, null);
                }
                break;

            case Keys.Return:
                ToggleShowList(EShowMode.PICTURE);
                break;

            case Keys.Delete:
                if (SubKey == 0)
                {
                    DeleteFileLists(0);
                }
                else if (SubKey == 2)
                {
                    DeleteFileLists(1);
                }
                else if (SubKey == 3)
                {
                    DeleteFileLists(2);
                }
                break;

            case Keys.Down:
                if (SubKey == 4)
                {
                    MoveSelectedList(1);
                }
                break;

            case Keys.Up:
                if (SubKey == 4)
                {
                    MoveSelectedList(-1);
                }
                break;

            case Keys.O:
                MnOpenFile_Click(null, null);
                break;

            case Keys.N:
                if (SubKey == 2)
                {
                    MnFileRename_Click(null, null);
                }
                break;

            case Keys.A:
                if (SubKey == 2)
                {
                    for (int i = 0; i < DisplayBox.Items.Count; i++)
                    {
                        DisplayBox.SetSelected(i, true);
                    }
                }
                break;

            case Keys.S:
                if (SubKey == 0)
                {
                    MnInScreen_Click(null, null);
                }
                else if (SubKey == 2)
                {
                    MnSave_Click(null, null);
                }
                break;

            case Keys.C:
                if (SubKey == 0)
                {
                    MnCenter_Click(null, null);
                }
                else if (SubKey == 2)
                {
                    MnFileCopy_Click(null, null);
                }
                else if (SubKey == 3)
                {
                    MnCopyFilePath_Click(null, null);
                }
                break;

            case Keys.T:
                if (SubKey == 0)
                {
                    MnAlwaysTop_Click(null, null);
                }
                else if (SubKey == 2)
                {
                    SortFileLists(ESortType_NAME);
                }
                break;

            case Keys.F:
                MnFullScreen_Click(null, null);
                break;

            case Keys.X:
                if (SubKey == 2)
                {
                    MnFileCut_Click(null, null);
                }
                break;

            case Keys.Back:
                MnCloseArchive_Click(null, null);
                break;

            case Keys.V:
                if (SubKey == 2)
                {
                    MnFilePaste_Click(null, null);
                }
                break;

            case Keys.I:
                if (SubKey == 2)
                {
                    for (int i = 0; i < DisplayBox.Items.Count; i++)
                    {
                        DisplayBox.SetSelected(i, !DisplayBox.GetSelected(i));
                    }
                }
                break;

            case Keys.D:
                if (SubKey == 2)
                {
                    for (int i = 0; i < DisplayBox.Items.Count; i++)
                    {
                        DisplayBox.SetSelected(i, false);
                    }
                }
                break;

            case Keys.P:
                if (SubKey == 2)
                {
                    MnOpenExistsFolder_Click(null, null);
                }
                else
                {
                    MnOpenFolder_Click(null, null);
                }
                break;

            case Keys.G:
                if (SubKey == 2)
                {
                    SortFileLists(ESortType_TIMESTAMP);
                }
                break;

            case Keys.E:
                if (SubKey == 2)
                {
                    SortFileLists(ESortType_EXT);
                }
                break;

            case Keys.Y:
                if (SubKey == 2)
                {
                    SortFileLists(ESortType_FILESIZE);
                }
                break;

            case Keys.U:
                if (SubKey == 2)
                {
                    SortFileLists(ESortType_REVERSE);
                }
                break;

            case Keys.R:
                if (SubKey == 2)
                {
                    SortFileLists(ESortType_RANDOM);
                }
                break;

            case Keys.Escape:
                Close();
                break;
            }
        }