int QuickView::ProcessKey(const Manager::Key& Key) { int LocalKey=Key.FarKey(); if (!IsVisible()) return FALSE; if (LocalKey>=KEY_RCTRL0 && LocalKey<=KEY_RCTRL9) { ExecShortcutFolder(LocalKey-KEY_RCTRL0); return TRUE; } if (LocalKey == KEY_F1) { Help::create(L"QViewPanel"); return TRUE; } if (LocalKey==KEY_F3 || LocalKey==KEY_NUMPAD5 || LocalKey == KEY_SHIFTNUMPAD5) { auto AnotherPanel = Parent()->GetAnotherPanel(this); if (AnotherPanel->GetType()==FILE_PANEL) AnotherPanel->ProcessKey(Manager::Key(KEY_F3)); return TRUE; } if (LocalKey==KEY_ADD || LocalKey==KEY_SUBTRACT) { auto AnotherPanel = Parent()->GetAnotherPanel(this); if (AnotherPanel->GetType()==FILE_PANEL) AnotherPanel->ProcessKey(Manager::Key(LocalKey==KEY_ADD?KEY_DOWN:KEY_UP)); return TRUE; } if (QView && !Directory && LocalKey>=256) { int ret = QView->ProcessKey(Manager::Key(LocalKey)); if (LocalKey == KEY_F2 || LocalKey == KEY_SHIFTF2 || LocalKey == KEY_F4 || LocalKey == KEY_SHIFTF4 || LocalKey == KEY_F8 || LocalKey == KEY_SHIFTF8) { DynamicUpdateKeyBar(); Parent()->GetKeybar().Redraw(); } if (LocalKey == KEY_F7 || LocalKey == KEY_SHIFTF7) { //__int64 Pos; //int Length; //DWORD Flags; //QView->GetSelectedParam(Pos,Length,Flags); Redraw(); Parent()->GetAnotherPanel(this)->Redraw(); //QView->SelectText(Pos,Length,Flags|1); } return ret; } return FALSE; }
int FolderTree::ProcessKey(const Manager::Key& Key) { int LocalKey=Key.FarKey(); if (LocalKey>=KEY_ALT_BASE+0x01 && LocalKey<=KEY_ALT_BASE+65535) LocalKey=ToLower(LocalKey-KEY_ALT_BASE); else if (LocalKey>=KEY_RALT_BASE+0x01 && LocalKey<=KEY_RALT_BASE+65535) LocalKey=ToLower(LocalKey-KEY_RALT_BASE); switch (LocalKey) { case KEY_F1: { Help::create(L"FindFolder"); } break; case KEY_ESC: case KEY_F10: Global->WindowManager->DeleteWindow(); SetExitCode(XC_MODIFIED); break; case KEY_NUMENTER: case KEY_ENTER: strNewFolder = Tree->GetCurDir(); if (os::fs::exists(strNewFolder)) { Global->WindowManager->DeleteWindow(); SetExitCode(XC_MODIFIED); } else { Tree->ProcessKey(Manager::Key(KEY_ENTER)); DrawEdit(); } break; case KEY_F5: IsFullScreen=!IsFullScreen; ResizeConsole(); Show(); return TRUE; case KEY_CTRLR: case KEY_RCTRLR: case KEY_F2: Tree->ProcessKey(Manager::Key(KEY_CTRLR)); DrawEdit(); break; case KEY_CTRLNUMENTER: case KEY_RCTRLNUMENTER: case KEY_CTRLSHIFTNUMENTER: case KEY_RCTRLSHIFTNUMENTER: case KEY_CTRLENTER: case KEY_RCTRLENTER: case KEY_CTRLSHIFTENTER: case KEY_RCTRLSHIFTENTER: { string strName; FindEdit->GetString(strName); Tree->FindPartName(strName, TRUE, LocalKey == KEY_CTRLSHIFTENTER || LocalKey == KEY_RCTRLSHIFTENTER || LocalKey == KEY_CTRLSHIFTNUMENTER || LocalKey == KEY_RCTRLSHIFTNUMENTER? -1 : 1); DrawEdit(); } break; case KEY_UP: case KEY_NUMPAD8: case KEY_DOWN: case KEY_NUMPAD2: case KEY_PGUP: case KEY_NUMPAD9: case KEY_PGDN: case KEY_NUMPAD3: case KEY_HOME: case KEY_NUMPAD7: case KEY_END: case KEY_NUMPAD1: case KEY_MSWHEEL_UP: case(KEY_MSWHEEL_UP | KEY_ALT): case(KEY_MSWHEEL_UP | KEY_RALT): case KEY_MSWHEEL_DOWN: case(KEY_MSWHEEL_DOWN | KEY_ALT): case(KEY_MSWHEEL_DOWN | KEY_RALT): FindEdit->SetString(L""); Tree->ProcessKey(Key); DrawEdit(); break; default: if (LocalKey == KEY_ADD || LocalKey == KEY_SUBTRACT) // OFM: Gray+/Gray- navigation { Tree->ProcessKey(Key); DrawEdit(); break; } /* else { if((Key&(~KEY_CTRLMASK)) == KEY_ADD) Key='+'; else if((Key&(~KEY_CTRLMASK)) == KEY_SUBTRACT) Key='-'; } */ if (FindEdit->ProcessKey(Key)) { string strName; FindEdit->GetString(strName); if (Tree->FindPartName(strName, FALSE, 1)) strLastName = strName; else { FindEdit->SetString(strLastName.data()); strName = strLastName; } DrawEdit(); } break; } return TRUE; }
static int ConsoleScrollHook(const Manager::Key& key) { // Удалить после появления макрофункции Scroll if (Global->Opt->WindowMode && Global->WindowManager->IsPanelsActive()) { switch (key.FarKey()) { case KEY_CTRLALTUP: case KEY_RCTRLRALTUP: case KEY_CTRLRALTUP: case KEY_RCTRLALTUP: case KEY_CTRLALTNUMPAD8: case KEY_RCTRLALTNUMPAD8: case KEY_CTRLRALTNUMPAD8: case KEY_RCTRLRALTNUMPAD8: Console().ScrollWindow(-1); return TRUE; case KEY_CTRLALTDOWN: case KEY_RCTRLRALTDOWN: case KEY_CTRLRALTDOWN: case KEY_RCTRLALTDOWN: case KEY_CTRLALTNUMPAD2: case KEY_RCTRLALTNUMPAD2: case KEY_CTRLRALTNUMPAD2: case KEY_RCTRLRALTNUMPAD2: Console().ScrollWindow(1); return TRUE; case KEY_CTRLALTPGUP: case KEY_RCTRLRALTPGUP: case KEY_CTRLRALTPGUP: case KEY_RCTRLALTPGUP: case KEY_CTRLALTNUMPAD9: case KEY_RCTRLALTNUMPAD9: case KEY_CTRLRALTNUMPAD9: case KEY_RCTRLRALTNUMPAD9: Console().ScrollWindow(-ScrY); return TRUE; case KEY_CTRLALTHOME: case KEY_RCTRLRALTHOME: case KEY_CTRLRALTHOME: case KEY_RCTRLALTHOME: case KEY_CTRLALTNUMPAD7: case KEY_RCTRLALTNUMPAD7: case KEY_CTRLRALTNUMPAD7: case KEY_RCTRLRALTNUMPAD7: Console().ScrollWindowToBegin(); return TRUE; case KEY_CTRLALTPGDN: case KEY_RCTRLRALTPGDN: case KEY_CTRLRALTPGDN: case KEY_RCTRLALTPGDN: case KEY_CTRLALTNUMPAD3: case KEY_RCTRLALTNUMPAD3: case KEY_CTRLRALTNUMPAD3: case KEY_RCTRLRALTNUMPAD3: Console().ScrollWindow(ScrY); return TRUE; case KEY_CTRLALTEND: case KEY_RCTRLRALTEND: case KEY_CTRLRALTEND: case KEY_RCTRLALTEND: case KEY_CTRLALTNUMPAD1: case KEY_RCTRLALTNUMPAD1: case KEY_CTRLRALTNUMPAD1: case KEY_RCTRLRALTNUMPAD1: Console().ScrollWindowToEnd(); return TRUE; } } return FALSE; }
int FilePanels::ProcessKey(const Manager::Key& Key) { auto LocalKey = Key.FarKey(); if (!LocalKey) return TRUE; if ((LocalKey==KEY_CTRLLEFT || LocalKey==KEY_CTRLRIGHT || LocalKey==KEY_CTRLNUMPAD4 || LocalKey==KEY_CTRLNUMPAD6 || LocalKey==KEY_RCTRLLEFT || LocalKey==KEY_RCTRLRIGHT || LocalKey==KEY_RCTRLNUMPAD4 || LocalKey==KEY_RCTRLNUMPAD6 /* || LocalKey==KEY_CTRLUP || LocalKey==KEY_CTRLDOWN || LocalKey==KEY_CTRLNUMPAD8 || LocalKey==KEY_CTRLNUMPAD2 */) && (CmdLine->GetLength()>0 || (!LeftPanel->IsVisible() && !RightPanel->IsVisible()))) { CmdLine->ProcessKey(Key); return TRUE; } switch (LocalKey) { case KEY_F1: { if (!m_ActivePanel->ProcessKey(Manager::Key(KEY_F1))) { Help::create(L"Contents"); } return TRUE; } case KEY_TAB: { SetAnhoterPanelFocus(); break; } case KEY_CTRLF1: case KEY_RCTRLF1: { if (LeftPanel->IsVisible()) { LeftPanel->Hide(); if (RightPanel->IsVisible()) RightPanel->SetFocus(); } else { if (!RightPanel->IsVisible()) LeftPanel->SetFocus(); LeftPanel->Show(); } Redraw(); break; } case KEY_CTRLF2: case KEY_RCTRLF2: { if (RightPanel->IsVisible()) { RightPanel->Hide(); if (LeftPanel->IsVisible()) LeftPanel->SetFocus(); } else { if (!LeftPanel->IsVisible()) RightPanel->SetFocus(); RightPanel->Show(); } Redraw(); break; } case KEY_CTRLB: case KEY_RCTRLB: { Global->Opt->ShowKeyBar=!Global->Opt->ShowKeyBar; m_KeyBarVisible = Global->Opt->ShowKeyBar; if (!m_KeyBarVisible) m_windowKeyBar->Hide(); SetScreenPosition(); Global->WindowManager->RefreshWindow(); break; } case KEY_CTRLT: case KEY_RCTRLT: if (Global->Opt->Tree.TurnOffCompletely) break; case KEY_CTRLL: case KEY_RCTRLL: case KEY_CTRLQ: case KEY_RCTRLQ: { if (m_ActivePanel->IsVisible()) { Panel *AnotherPanel = PassivePanel(); int NewType; if (LocalKey==KEY_CTRLL || LocalKey==KEY_RCTRLL) NewType=INFO_PANEL; else if (LocalKey==KEY_CTRLQ || LocalKey==KEY_RCTRLQ) NewType=QVIEW_PANEL; else NewType=TREE_PANEL; if (m_ActivePanel->GetType() == NewType) AnotherPanel = m_ActivePanel; if (!AnotherPanel->ProcessPluginEvent(FE_CLOSE,nullptr)) { if (AnotherPanel->GetType()==NewType) /* $ 19.09.2000 IS Повторное нажатие на ctrl-l|q|t всегда включает файловую панель */ AnotherPanel=ChangePanel(AnotherPanel,FILE_PANEL,FALSE,FALSE); else AnotherPanel=ChangePanel(AnotherPanel,NewType,FALSE,FALSE); /* $ 07.09.2001 VVM ! При возврате из CTRL+Q, CTRL+L восстановим каталог, если активная панель - дерево. */ if (m_ActivePanel->GetType() == TREE_PANEL) { string strCurDir(m_ActivePanel->GetCurDir()); AnotherPanel->SetCurDir(strCurDir, true); AnotherPanel->Update(0); } else AnotherPanel->Update(UPDATE_KEEP_SELECTION); AnotherPanel->Show(); } m_ActivePanel->SetFocus(); } break; } case KEY_CTRLO: case KEY_RCTRLO: { { int LeftVisible=LeftPanel->IsVisible(); int RightVisible=RightPanel->IsVisible(); int HideState=!LeftVisible && !RightVisible; if (!HideState) { LeftStateBeforeHide=LeftVisible; RightStateBeforeHide=RightVisible; LeftPanel->Hide(); RightPanel->Hide(); Global->WindowManager->RefreshWindow(); } else { if (!LeftStateBeforeHide && !RightStateBeforeHide) LeftStateBeforeHide=RightStateBeforeHide=TRUE; if (LeftStateBeforeHide) LeftPanel->Show(); if (RightStateBeforeHide) RightPanel->Show(); if (!m_ActivePanel->IsVisible()) { if (m_ActivePanel == RightPanel) LeftPanel->SetFocus(); else RightPanel->SetFocus(); } } } break; } case KEY_CTRLP: case KEY_RCTRLP: { if (m_ActivePanel->IsVisible()) { Panel *AnotherPanel = PassivePanel(); if (AnotherPanel->IsVisible()) AnotherPanel->Hide(); else AnotherPanel->Show(); CmdLine->Redraw(); } Global->WindowManager->RefreshWindow(); break; } case KEY_CTRLI: case KEY_RCTRLI: { m_ActivePanel->EditFilter(); return TRUE; } case KEY_CTRLU: case KEY_RCTRLU: { if (!LeftPanel->IsVisible() && !RightPanel->IsVisible()) CmdLine->ProcessKey(Key); else SwapPanels(); break; } /* $ 08.04.2002 IS При смене диска установим принудительно текущий каталог на активной панели, т.к. система не знает ничего о том, что у Фара две панели, и текущим для системы после смены диска может быть каталог и на пассивной панели */ case KEY_ALTF1: case KEY_RALTF1: { LeftPanel->ChangeDisk(); if (ActivePanel() != LeftPanel) ActivePanel()->SetCurPath(); break; } case KEY_ALTF2: case KEY_RALTF2: { RightPanel->ChangeDisk(); if (ActivePanel() != RightPanel) ActivePanel()->SetCurPath(); break; } case KEY_ALTF7: case KEY_RALTF7: { FindFiles(); break; } case KEY_CTRLUP: case KEY_CTRLNUMPAD8: case KEY_RCTRLUP: case KEY_RCTRLNUMPAD8: { bool Set=false; if (Global->Opt->LeftHeightDecrement<ScrY-7) { ++Global->Opt->LeftHeightDecrement; Set=true; } if (Global->Opt->RightHeightDecrement<ScrY-7) { ++Global->Opt->RightHeightDecrement; Set=true; } if(Set) { SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLDOWN: case KEY_CTRLNUMPAD2: case KEY_RCTRLDOWN: case KEY_RCTRLNUMPAD2: { bool Set=false; if (Global->Opt->LeftHeightDecrement>0) { --Global->Opt->LeftHeightDecrement; Set=true; } if (Global->Opt->RightHeightDecrement>0) { --Global->Opt->RightHeightDecrement; Set=true; } if(Set) { SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLSHIFTUP: case KEY_CTRLSHIFTNUMPAD8: case KEY_RCTRLSHIFTUP: case KEY_RCTRLSHIFTNUMPAD8: { IntOption& HeightDecrement = (m_ActivePanel == LeftPanel) ? Global->Opt->LeftHeightDecrement : Global->Opt->RightHeightDecrement; if (HeightDecrement<ScrY-7) { ++HeightDecrement; SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLSHIFTDOWN: case KEY_CTRLSHIFTNUMPAD2: case KEY_RCTRLSHIFTDOWN: case KEY_RCTRLSHIFTNUMPAD2: { IntOption& HeightDecrement = (m_ActivePanel == LeftPanel) ? Global->Opt->LeftHeightDecrement : Global->Opt->RightHeightDecrement; if (HeightDecrement>0) { --HeightDecrement; SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLLEFT: case KEY_CTRLNUMPAD4: case KEY_RCTRLLEFT: case KEY_RCTRLNUMPAD4: { if (Global->Opt->WidthDecrement<ScrX/2-10) { ++Global->Opt->WidthDecrement; SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLRIGHT: case KEY_CTRLNUMPAD6: case KEY_RCTRLRIGHT: case KEY_RCTRLNUMPAD6: { if (Global->Opt->WidthDecrement>-(ScrX/2-10)) { --Global->Opt->WidthDecrement; SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLCLEAR: case KEY_RCTRLCLEAR: { if (Global->Opt->WidthDecrement) { Global->Opt->WidthDecrement=0; SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_CTRLALTCLEAR: case KEY_RCTRLRALTCLEAR: case KEY_CTRLRALTCLEAR: case KEY_RCTRLALTCLEAR: { bool Set=false; if (Global->Opt->LeftHeightDecrement) { Global->Opt->LeftHeightDecrement=0; Set=true; } if (Global->Opt->RightHeightDecrement) { Global->Opt->RightHeightDecrement=0; Set=true; } if(Set) { SetScreenPosition(); Global->WindowManager->RefreshWindow(); } break; } case KEY_F9: { Global->Opt->ShellOptions(false,nullptr); return TRUE; } case KEY_SHIFTF10: { Global->Opt->ShellOptions(true,nullptr); return TRUE; } case KEY_F11: { // We will never get here in normal flow since F11 is processed by manager itself, // but auto-completion menu can forward keys back to the owner return Global->WindowManager->ProcessKey(Key); } default: { if (LocalKey >= KEY_CTRL0 && LocalKey <= KEY_CTRL9) ChangePanelViewMode(m_ActivePanel, LocalKey - KEY_CTRL0, TRUE); if (!m_ActivePanel->ProcessKey(Key)) CmdLine->ProcessKey(Key); break; } } return TRUE; }