void CaseConvertion() { struct Options Backup; memcpy(&Backup,&Opt,sizeof(Backup)); PluginDialogBuilder Builder(Info, MainGuid, DialogGuid, MFileCase, L"Contents", DlgProc); Builder.StartColumns(); Builder.AddText(MName); const int NameIDs[] = {MLower, MUpper, MFirst, MTitle, MNone}; Builder.AddRadioButtons(&Opt.ConvertMode, ARRAYSIZE(NameIDs), NameIDs, true); Builder.ColumnBreak(); Builder.AddText(MExtension); const int ExtIDs[] = {MLowerExt, MUpperExt, MFirstExt, MTitleExt, MNoneExt}; Builder.AddRadioButtons(&Opt.ConvertModeExt, ARRAYSIZE(ExtIDs), ExtIDs); Builder.EndColumns(); Builder.AddSeparator(); Builder.AddCheckbox(MSkipMixedCase, &Opt.SkipMixedCase); Builder.AddCheckbox(MProcessSubDir, &Opt.ProcessSubDir); Builder.AddCheckbox(MProcessDir, &Opt.ProcessDir); Builder.AddSeparator(); int CurRun = 0; Builder.AddCheckbox(MCurRun, &CurRun); Builder.AddSeparator(); Builder.AddText(MWordDiv); FarDialogItem *Edit = Builder.AddEditField(Opt.WordDiv,ARRAYSIZE(Opt.WordDiv),20,L"FileCase_WordDiv"); WordDivEditID = Builder.GetLastID(); Builder.AddButtonAfter(Edit, MReset); ResetButtonID = Builder.GetLastID(); Builder.AddOKCancel(MOk, MCancel); if (Builder.ShowDialog()) { if (Opt.ConvertMode!=MODE_NONE || Opt.ConvertModeExt!=MODE_NONE) { Opt.WordDivLen=lstrlen(Opt.WordDiv); struct PanelInfo PInfo = {sizeof(PanelInfo)}; Info.PanelControl(PANEL_ACTIVE,FCTL_GETPANELINFO,0,&PInfo); HANDLE hScreen=Info.SaveScreen(0,0,-1,-1); const wchar_t *MsgItems[]= {GetMsg(MFileCase),GetMsg(MConverting)}; Info.Message(&MainGuid, nullptr,0,NULL,MsgItems,ARRAYSIZE(MsgItems),0); wchar_t FullName[MAX_PATH]; int Size=(int)Info.PanelControl(PANEL_ACTIVE,FCTL_GETPANELDIRECTORY,0,0); FarPanelDirectory* dirInfo=(FarPanelDirectory*)new char[Size]; dirInfo->StructSize = sizeof(FarPanelDirectory); Info.PanelControl(PANEL_ACTIVE,FCTL_GETPANELDIRECTORY,Size,dirInfo); for (size_t I=0; I < PInfo.SelectedItemsNumber; I++) { size_t Size = Info.PanelControl(PANEL_ACTIVE,FCTL_GETSELECTEDPANELITEM,I,0); PluginPanelItem* PPI=(PluginPanelItem*)malloc(Size); if (PPI) { FarGetPluginPanelItem gpi= {sizeof(FarGetPluginPanelItem), Size, PPI}; Info.PanelControl(PANEL_ACTIVE,FCTL_GETSELECTEDPANELITEM,I,&gpi); GetFullName(FullName,dirInfo->Name,PPI->FileName); ProcessName(FullName,(DWORD)PPI->FileAttributes); free(PPI); } } delete[](char*)dirInfo; if (!CurRun) { PluginSettings settings(MainGuid, Info.SettingsControl); settings.Set(0,L"WordDiv",Opt.WordDiv); settings.Set(0,L"ConvertMode",Opt.ConvertMode); settings.Set(0,L"ConvertModeExt",Opt.ConvertModeExt); settings.Set(0,L"SkipMixedCase",Opt.SkipMixedCase); settings.Set(0,L"ProcessSubDir",Opt.ProcessSubDir); settings.Set(0,L"ProcessDir",Opt.ProcessDir); } Info.RestoreScreen(hScreen); Info.PanelControl(PANEL_ACTIVE,FCTL_UPDATEPANEL,0,0); Info.PanelControl(PANEL_ACTIVE,FCTL_REDRAWPANEL,0,0); } if (CurRun) memcpy(&Opt,&Backup,sizeof(Opt)); } }
bool Search::ProcessKey(const Manager::Key& Key) { auto LocalKey = Key; // для вставки воспользуемся макродвижком... if (LocalKey()==KEY_CTRLV || LocalKey()==KEY_RCTRLV || LocalKey()==KEY_SHIFTINS || LocalKey()==KEY_SHIFTNUMPAD0) { string ClipText; if (GetClipboardText(ClipText)) { if (!ClipText.empty()) { ProcessName(ClipText); ShowBorder(); } } return true; } else if (LocalKey() == KEY_OP_XLAT) { m_FindEdit->Xlat(); const auto strTempName = m_FindEdit->GetString(); m_FindEdit->ClearString(); ProcessName(strTempName); Redraw(); return true; } else if (LocalKey() == KEY_OP_PLAINTEXT) { m_FindEdit->ProcessKey(LocalKey); const auto strTempName = m_FindEdit->GetString(); m_FindEdit->ClearString(); ProcessName(strTempName); Redraw(); return true; } else LocalKey=_CorrectFastFindKbdLayout(Key.Event(),LocalKey()); if (LocalKey()==KEY_ESC || LocalKey()==KEY_F10) { m_KeyToProcess=KEY_NONE; Close(); return true; } // // _SVS(if (!FirstKey) SysLog(L"Panel::FastFind Key=%s %s",_FARKEY_ToName(Key),_INPUT_RECORD_Dump(&rec))); if (LocalKey()>=KEY_ALT_BASE+0x01 && LocalKey()<=KEY_ALT_BASE+65535) LocalKey=lower(static_cast<WCHAR>(LocalKey()-KEY_ALT_BASE)); else if (LocalKey()>=KEY_RALT_BASE+0x01 && LocalKey()<=KEY_RALT_BASE+65535) LocalKey=lower(static_cast<WCHAR>(LocalKey()-KEY_RALT_BASE)); if (LocalKey()>=KEY_ALTSHIFT_BASE+0x01 && LocalKey()<=KEY_ALTSHIFT_BASE+65535) LocalKey=lower(static_cast<WCHAR>(LocalKey()-KEY_ALTSHIFT_BASE)); else if (LocalKey()>=KEY_RALTSHIFT_BASE+0x01 && LocalKey()<=KEY_RALTSHIFT_BASE+65535) LocalKey=lower(static_cast<WCHAR>(LocalKey()-KEY_RALTSHIFT_BASE)); if (LocalKey()==KEY_MULTIPLY) LocalKey=L'*'; switch (LocalKey()) { case KEY_F1: { Hide(); { Help::create(L"FastFind"sv); } Show(); break; } case KEY_CTRLNUMENTER: case KEY_RCTRLNUMENTER: case KEY_CTRLENTER: case KEY_RCTRLENTER: m_Owner->FindPartName(m_FindEdit->GetString(), TRUE, 1); Redraw(); break; case KEY_CTRLSHIFTNUMENTER: case KEY_RCTRLSHIFTNUMENTER: case KEY_CTRLSHIFTENTER: case KEY_RCTRLSHIFTENTER: m_Owner->FindPartName(m_FindEdit->GetString(), TRUE, -1); Redraw(); break; case KEY_NONE: case KEY_IDLE: break; default: if ((LocalKey()<32 || LocalKey()>=65536) && LocalKey()!=KEY_BS && LocalKey()!=KEY_CTRLY && LocalKey()!=KEY_RCTRLY && LocalKey()!=KEY_CTRLBS && LocalKey()!=KEY_RCTRLBS && !IsModifKey(LocalKey()) && !(LocalKey()==KEY_CTRLINS||LocalKey()==KEY_CTRLNUMPAD0) && // KEY_RCTRLINS/NUMPAD0 passed to panels !(LocalKey()==KEY_SHIFTINS||LocalKey()==KEY_SHIFTNUMPAD0) && !((LocalKey() == KEY_KILLFOCUS || LocalKey() == KEY_GOTFOCUS) && IsWindowsVistaOrGreater()) // Mantis #2903 ) { m_KeyToProcess=LocalKey; Close(); return true; } auto strLastName = m_FindEdit->GetString(); if (m_FindEdit->ProcessKey(LocalKey)) { auto strName = m_FindEdit->GetString(); // уберем двойные '**' if (strName.size() > 1 && strName.back() == L'*' && strName[strName.size()-2] == L'*') { strName.pop_back(); m_FindEdit->SetString(strName); } /* $ 09.04.2001 SVS проблемы с быстрым поиском. Подробнее в 00573.ChangeDirCrash.txt */ if (starts_with(strName, L'"')) { strName.erase(0, 1); m_FindEdit->SetString(strName); } if (m_Owner->FindPartName(strName, FALSE, 1)) { strLastName = strName; } else { if (Global->CtrlObject->Macro.IsExecuting())// && Global->CtrlObject->Macro.GetLevelState() > 0) // если вставка макросом... { //Global->CtrlObject->Macro.DropProcess(); // ... то дропнем макропроцесс //Global->CtrlObject->Macro.PopState(); ; } m_FindEdit->SetString(strLastName); } Redraw(); } break; } return true; }