/*=========================================================================== * * Class CSrScrlView Method - void UpdateEffectList (ListIndex, Update); * *=========================================================================*/ void CSrScrlView::UpdateEffectList (const int ListIndex, const bool Update) { CSrFormidSubrecord* pEffectID; srrlcustomdata_t* pCustomData; srformid_t FormID; CString Buffer; if (GetInputRecord() == NULL) return; pCustomData = m_EffectList.GetCustomData(ListIndex); if (pCustomData == NULL) return; if (Update) m_EffectList.UpdateRecord(ListIndex); pEffectID = SrCastClassNull(CSrFormidSubrecord, pCustomData->Subrecords[0]); if (pEffectID == NULL) return; FormID = pEffectID->GetValue(); Buffer.Format("0x%08X", FormID); m_EffectList.SetCustomField(ListIndex, SR_FIELD_EFFECTID, Buffer); CSrRecord* pRecord = GetInputRecord()->GetParent()->FindFormID(FormID); CSrIdRecord* pIdRecord = SrCastClassNull(CSrIdRecord, pRecord); if (pIdRecord != NULL) m_EffectList.SetCustomField(ListIndex, SR_FIELD_EFFECTNAME, pIdRecord->GetEditorID()); Buffer.Format("%d", pCustomData->UserCount); m_EffectList.SetCustomField(ListIndex, SR_FIELD_CONDITIONCOUNT, Buffer); }
void CSrScrlView::OnBnClickedAddButton() { srscrl_effectdata_t* pNewEffect = new srscrl_effectdata_t; CSrSubrecord* pSubrecord; pSubrecord = GetInputRecord()->CreateSubrecord(SR_NAME_EFID); pNewEffect->pEffect = SrCastClassNull(CSrFormidSubrecord, pSubrecord); pSubrecord = GetInputRecord()->CreateSubrecord(SR_NAME_EFIT); pNewEffect->pEffectData = SrCastClassNull(CSrEfitSubrecord, pSubrecord); if (pNewEffect->pEffect == NULL || pNewEffect->pEffectData == NULL) { delete pNewEffect; return; } pNewEffect->pEffect->InitializeNew(); pNewEffect->pEffectData->InitializeNew(); GetCurrentEffect(); m_Effects.Add(pNewEffect); AddEffectList(pNewEffect); m_EffectList.SelectRecord(m_Effects.GetSize() - 1); SetCurrentEffect(m_Effects[m_Effects.GetSize() - 1]); }
int Modal::ReadInput(INPUT_RECORD *GetReadRec) { if (GetReadRec) memset(GetReadRec,0,sizeof(INPUT_RECORD)); if (WriteKey>=0) { ReadKey=WriteKey; WriteKey=-1; } else { ReadKey=GetInputRecord(&ReadRec); if (GetReadRec) { *GetReadRec=ReadRec; } } if (ReadKey == KEY_CONSOLE_BUFFER_RESIZE) { LockScreen LckScr; Hide(); Show(); } if (CloseFARMenu) { SetExitCode(-1); } return(ReadKey); }
/*=========================================================================== * * Class CSrContView Event - void OnLvllistEdit (); * *=========================================================================*/ void CSrContView::OnLvllistEdit() { CSrCntoSubrecord* pSubrecord; srrlcustomdata_t* pCustomData; srlvllistinfo_t* pListInfo; int ListIndex; int Result; ListIndex = m_ItemList.GetSelectedItem(); if (ListIndex < 0) return; pCustomData = m_ItemList.GetCustomData(ListIndex); if (pCustomData == NULL) return; pSubrecord = SrCastClassNull(CSrCntoSubrecord, pCustomData->Subrecords[0]); if (pSubrecord == NULL) return; pListInfo = SrFindLvlListInfo(m_LvlListInfo, pSubrecord); if (pListInfo == NULL) return; Result = SrEditContItemDlg(pListInfo, m_pDlgHandler, GetInputRecord()->GetFormID()); if (Result == SR_CONTITEMDLG_RESULT_CANCEL) return; if (Result == SR_CONTITEMDLG_RESULT_DELETE) { m_LvlListInfo.Delete(pListInfo); m_ItemList.RemoveItem(ListIndex); return; } SrCreateLvlListInfoCustomData(*pCustomData, *pListInfo, m_pRecordHandler); UpdateItem(ListIndex, pListInfo); }
int SimpleModal::ReadInput(INPUT_RECORD *GetReadRec) { if (GetReadRec) ClearStruct(*GetReadRec); if (m_WriteKey>=0) { m_ReadKey=m_WriteKey; m_WriteKey=-1; } else { m_ReadKey=GetInputRecord(&m_ReadRec); if (GetReadRec) { *GetReadRec=m_ReadRec; } } if (m_ReadKey == KEY_CONSOLE_BUFFER_RESIZE) { SCOPED_ACTION(LockScreen); Hide(); Show(); } if (Global->CloseFARMenu) { SetExitCode(-1); } return m_ReadKey; }
void CSrScrlView::GetCurrentEffect (void) { CString Buffer; if (m_pCurrentEffect == NULL) return; if (m_pCurrentEffect->pEffectData) { m_Magnitude.GetWindowText(Buffer); m_pCurrentEffect->pEffectData->SetMagnitude((float) atof(Buffer)); m_Area.GetWindowText(Buffer); m_pCurrentEffect->pEffectData->SetArea(atoi(Buffer)); m_Duration.GetWindowText(Buffer); m_pCurrentEffect->pEffectData->SetDuration(atoi(Buffer)); } if (m_pCurrentEffect->pEffect) { m_EffectName.GetWindowText(Buffer); Buffer.Trim(); if (Buffer.IsEmpty()) { m_pCurrentEffect->pEffect->SetValue(0); } else { CSrIdRecord* pRecord = GetInputRecord()->GetParent()->FindEditorID(Buffer); if (pRecord) m_pCurrentEffect->pEffect->SetValue(pRecord->GetFormID()); } } for (dword i = 0; i < m_Effects.GetSize(); ++i) { srrlcustomdata_t* pCustomData = (srrlcustomdata_t *) m_EffectList.GetItemData(i); if (pCustomData == NULL) continue; CSrFormidSubrecord* pEffect = SrCastClassNull(CSrFormidSubrecord, pCustomData->Subrecords[0]); if (pEffect == NULL) continue; if (pEffect != m_pCurrentEffect->pEffect) continue; pCustomData->UserCount = m_pCurrentEffect->Conditions.GetSize(); pCustomData->Subrecords.Truncate(2); int CDIndex = 2; for (dword j = 0; j < m_pCurrentEffect->Conditions.GetSize(); ++j) { srconditioninfo_t* pCondInfo = m_pCurrentEffect->Conditions[j]; pCustomData->Subrecords.Add(&pCondInfo->Condition); if (pCondInfo->pParam1 != NULL) pCustomData->Subrecords.Add(pCondInfo->pParam1); if (pCondInfo->pParam2 != NULL) pCustomData->Subrecords.Add(pCondInfo->pParam2); } UpdateEffectList(i, true); break; } }
void CSrScrlView::OnBnClickedConditionButton() { if (m_pCurrentEffect == NULL) return; CSrConditionDlg ConditionDlg; int Result = ConditionDlg.DoModal(GetInputRecord(), &m_pCurrentEffect->Conditions); if (Result != IDOK) return; CString Buffer; Buffer.Format("%d", m_pCurrentEffect->Conditions.GetSize()); m_EffectConditions.SetWindowText(Buffer); GetCurrentEffect(); }
void CSrScrlView::SetCurrentEffect (srscrl_effectdata_t* pEffectData) { CString Buffer; EnableEffectControls(pEffectData != NULL); m_pCurrentEffect = pEffectData; if (pEffectData == NULL) { m_Magnitude.SetWindowText(""); m_Area.SetWindowText(""); m_Duration.SetWindowText(""); m_EffectName.SetWindowText(""); m_EffectConditions.SetWindowText(""); return; } if (m_pCurrentEffect->pEffectData) { Buffer.Format("%g", m_pCurrentEffect->pEffectData->GetMagnitude()); m_Magnitude.SetWindowText(Buffer); Buffer.Format("%u", m_pCurrentEffect->pEffectData->GetArea()); m_Area.SetWindowText(Buffer); Buffer.Format("%u", m_pCurrentEffect->pEffectData->GetDuration()); m_Duration.SetWindowText(Buffer); } else { m_Magnitude.SetWindowText(""); m_Area.SetWindowText(""); m_Duration.SetWindowText(""); } if (m_pCurrentEffect->pEffect) { m_EffectName.SetWindowText(GetInputRecord()->GetParent()->GetEditorID(m_pCurrentEffect->pEffect->GetValue())); } else { m_EffectName.SetWindowTextA(""); } Buffer.Format("%u", m_pCurrentEffect->Conditions.GetSize()); m_EffectConditions.SetWindowText(Buffer); }
/*=========================================================================== * * Class CSrContView Event - void OnLvllistAdd (); * *=========================================================================*/ void CSrContView::OnLvllistAdd() { srlvllistinfo_t* pNewInfo; int Result; pNewInfo = m_LvlListInfo.AddNew(); pNewInfo->InitializeNew(SR_NAME_CONT); Result = SrEditContItemDlg(pNewInfo, m_pDlgHandler, GetInputRecord()->GetFormID()); if (Result == SR_CONTITEMDLG_RESULT_CANCEL || Result == SR_CONTITEMDLG_RESULT_DELETE) { m_LvlListInfo.Delete(pNewInfo); return; } AddItemList(pNewInfo); }
/*=========================================================================== * * Class CSrScrlView Method - int AddEffectList (pEffectData); * *=========================================================================*/ int CSrScrlView::AddEffectList (srscrl_effectdata_t* pEffectData) { srrlcustomdata_t CustomData; CString Buffer; int ListIndex; CustomData.UserCount = pEffectData->Conditions.GetSize(); CustomData.pRecord = GetInputRecord(); CustomData.Subrecords.Add(pEffectData->pEffect); CustomData.Subrecords.Add(pEffectData->pEffectData); for (dword i = 0; i < pEffectData->Conditions.GetSize(); ++i) { CustomData.Subrecords.Add(&pEffectData->Conditions[i]->Condition); } ListIndex = m_EffectList.AddCustomRecord(CustomData); if (ListIndex < 0) return (-1); UpdateEffectList(ListIndex, false); return (ListIndex); }
void Manager::ProcessMainLoop() { if ( CurrentFrame ) CtrlObject->Macro.SetMode(CurrentFrame->GetMacroMode()); if ( CurrentFrame && !CurrentFrame->ProcessEvents() ) { ProcessKey(KEY_IDLE); } else { // Mantis#0000073: Не работает автоскролинг в QView Global->WaitInMainLoop=IsPanelsActive(true); //WaitInFastFind++; int Key=GetInputRecord(&LastInputRecord); //WaitInFastFind--; Global->WaitInMainLoop=FALSE; if (EndLoop) return; if (LastInputRecord.EventType==MOUSE_EVENT && !(Key==KEY_MSWHEEL_UP || Key==KEY_MSWHEEL_DOWN || Key==KEY_MSWHEEL_RIGHT || Key==KEY_MSWHEEL_LEFT)) { // используем копию структуры, т.к. LastInputRecord может внезапно измениться во время выполнения ProcessMouse MOUSE_EVENT_RECORD mer=LastInputRecord.Event.MouseEvent; ProcessMouse(&mer); } else ProcessKey(Key); } if(IsPanelsActive()) { if(!Global->PluginPanelsCount) { CtrlObject->Plugins->RefreshPluginsList(); } } }
static int CASHook(const Manager::Key& key) { if (key.IsEvent()) { const KEY_EVENT_RECORD& rec=key.Event().Event.KeyEvent; if (rec.bKeyDown) { switch (rec.wVirtualKeyCode) { case VK_SHIFT: case VK_MENU: case VK_CONTROL: { const auto maskLeft=LEFT_CTRL_PRESSED|LEFT_ALT_PRESSED|SHIFT_PRESSED, maskRight=RIGHT_CTRL_PRESSED|RIGHT_ALT_PRESSED|SHIFT_PRESSED; auto state=rec.dwControlKeyState; auto wait=[](DWORD mask) { for (;;) { INPUT_RECORD rec; if (PeekInputRecord(&rec,true)) { GetInputRecord(&rec,true,true); if ((rec.Event.KeyEvent.dwControlKeyState&mask) != mask) break; } Sleep(1); } }; auto case1 = Global->Opt->CASRule&1 && (state&maskLeft) == maskLeft, case2 = Global->Opt->CASRule&2 && (state&maskRight) == maskRight; if (case1 || case2) { auto maskCurrent = case1?maskLeft:maskRight; const auto currentWindow = Global->WindowManager->GetCurrentWindow(); if (currentWindow->CanFastHide()) { int isPanelFocus=currentWindow->GetType() == windowtype_panels; if (isPanelFocus) { int LeftVisible=Global->CtrlObject->Cp()->LeftPanel->IsVisible(); int RightVisible=Global->CtrlObject->Cp()->RightPanel->IsVisible(); int CmdLineVisible=Global->CtrlObject->CmdLine()->IsVisible(); int KeyBarVisible=Global->CtrlObject->Cp()->GetKeybar().IsVisible(); Manager::ShowBackground(); Global->CtrlObject->Cp()->LeftPanel->HideButKeepSaveScreen(); Global->CtrlObject->Cp()->RightPanel->HideButKeepSaveScreen(); switch (Global->Opt->PanelCtrlAltShiftRule) { case 0: if (CmdLineVisible) Global->CtrlObject->CmdLine()->Show(); if (KeyBarVisible) Global->CtrlObject->Cp()->GetKeybar().Show(); break; case 1: if (KeyBarVisible) Global->CtrlObject->Cp()->GetKeybar().Show(); break; } wait(maskCurrent); if (LeftVisible) Global->CtrlObject->Cp()->LeftPanel->Show(); if (RightVisible) Global->CtrlObject->Cp()->RightPanel->Show(); if (CmdLineVisible) Global->CtrlObject->CmdLine()->Show(); if (KeyBarVisible) Global->CtrlObject->Cp()->GetKeybar().Show(); } else { Global->WindowManager->ImmediateHide(); wait(maskCurrent); } Global->WindowManager->RefreshWindow(); } return TRUE; } break; } } } } return FALSE; }
void CSrScrlView::CreateEffectArray (void) { CSrScrlRecord* pScroll; CSrSubrecord* pSubrecord; CSrSubrecord* pNewSubrecord; CSrFormidSubrecord* pEffectID; srscrl_effectdata_t* pEffectData; int Position; int EfitCount; m_Effects.Empty(); pScroll = SrCastClassNull(CSrScrlRecord, GetInputRecord()); if (pScroll == NULL) return; pSubrecord = pScroll->FindFirstSubrecord(SR_NAME_EFID, Position); while (pSubrecord) { pEffectID = SrCastClass(CSrFormidSubrecord, pSubrecord); if (pEffectID == NULL) goto CreateEffectArray_EndLoop; pEffectData = new srscrl_effectdata_t; m_Effects.Add(pEffectData); pSubrecord = GetInputRecord()->CreateSubrecord(SR_NAME_EFID); pEffectData->pEffect = SrCastClassNull(CSrFormidSubrecord, pSubrecord); if (pEffectData->pEffect == NULL) goto CreateEffectArray_EndLoop; pEffectData->pEffect->InitializeNew(); pEffectData->pEffect->Copy(pEffectID); EfitCount = 0; for (int i = Position + 1; i < (int) pScroll->GetNumSubrecords(); ++i) { pSubrecord = pScroll->GetSubrecord(i); if (pSubrecord == NULL) continue; if (pSubrecord->GetRecordType() == SR_NAME_EFID) break; if (pSubrecord->GetRecordType() == SR_NAME_CTDA) { srconditioninfo_t* pNewCond = new srconditioninfo_t; pNewCond->Condition.Copy(pSubrecord); pEffectData->Conditions.Add(pNewCond); pSubrecord = pScroll->GetSubrecord(i+1); if (pSubrecord == NULL) continue; if (pSubrecord->GetRecordType() == SR_NAME_CIS1) pNewCond->CopyParam1(pSubrecord); else if (pSubrecord->GetRecordType() == SR_NAME_CIS2) pNewCond->CopyParam2(pSubrecord); pSubrecord = pScroll->GetSubrecord(i+2); if (pSubrecord == NULL) continue; if (pSubrecord->GetRecordType() == SR_NAME_CIS2 && pNewCond->pParam2 == NULL) pNewCond->CopyParam2(pSubrecord); } else if (pSubrecord->GetRecordType() == SR_NAME_EFIT) { ++EfitCount; if (EfitCount > 1) SystemLog.Printf("WARNING: More than one EFIT per EFID found in SCRL 0x%08X!", pScroll->GetFormID()); pNewSubrecord = GetInputRecord()->CreateSubrecord(SR_NAME_EFIT); pEffectData->pEffectData = SrCastClassNull(CSrEfitSubrecord, pNewSubrecord); if (pEffectData->pEffectData == NULL) continue; pEffectData->pEffectData->InitializeNew(); pEffectData->pEffectData->Copy(pSubrecord); } else { SystemLog.Printf("WARNING: Unknown subrecord type %4.4s found in SCRL effects!", pSubrecord->GetRecordType().Name); } } CreateEffectArray_EndLoop: pSubrecord = pScroll->FindNextSubrecord(SR_NAME_EFID, Position); } }
/*=========================================================================== * * Class CSrContView Method - void SaveSubrecords (void); * *=========================================================================*/ void CSrContView::SaveSubrecords (void) { SrCreateLvlListInfo(m_LvlListInfo, GetInputRecord()); }
void HMenu::ProcessSubMenu(MenuDataEx *Data,int DataCount, const wchar_t *SubMenuHelp,int X,int Y,int &Position) { if (SubMenu) delete SubMenu; Position=-1; SubMenu=new VMenu(L"",Data,DataCount); SubMenu->SetFlags(VMENU_NOTCHANGE); SubMenu->SetBoxType(SHORT_DOUBLE_BOX); SubMenu->SetFlags(VMENU_WRAPMODE); SubMenu->SetHelp(SubMenuHelp); SubMenu->SetPosition(X,Y,0,0); SubMenu->Show(); while (!SubMenu->Done() && !CloseFARMenu) { INPUT_RECORD rec; int Key; Key=GetInputRecord(&rec); if (Key==KEY_CONSOLE_BUFFER_RESIZE) { LockScreen LckScr; ResizeConsole(); Show(); SubMenu->Hide(); SubMenu->Show(); } else if (rec.EventType==MOUSE_EVENT) { if (rec.Event.MouseEvent.dwMousePosition.Y==Y1) if (ProcessMouse(&rec.Event.MouseEvent)) { delete SubMenu; SubMenu=nullptr; return; } if(Key == KEY_MSWHEEL_UP || Key == KEY_MSWHEEL_DOWN || Key == KEY_MSWHEEL_RIGHT || Key == KEY_MSWHEEL_LEFT) { SubMenu->ProcessKey(Key); } else { SubMenu->ProcessMouse(&rec.Event.MouseEvent); } } else { if (Key == KEY_LEFT || Key == KEY_RIGHT ||Key == KEY_TAB || Key == KEY_NUMPAD4 || Key == KEY_NUMPAD6 || Key == KEY_MSWHEEL_LEFT || Key == KEY_MSWHEEL_RIGHT) { delete SubMenu; SubMenu=nullptr; ProcessKey(Key); ProcessKey(KEY_ENTER); return; } SubMenu->ProcessKey(Key); } } Position=SubMenu->Modal::GetExitCode(); delete SubMenu; SubMenu=nullptr; }
int KeyBar::ProcessMouse(MOUSE_EVENT_RECORD *MouseEvent) { INPUT_RECORD rec; int Key; if (!IsVisible()) return FALSE; if (!(MouseEvent->dwButtonState & 3) || MouseEvent->dwEventFlags) return FALSE; if (MouseEvent->dwMousePosition.X<X1 || MouseEvent->dwMousePosition.X>X2 || MouseEvent->dwMousePosition.Y!=Y1) return FALSE; #if 1 //Maximus: на таблетках лучше бы все кнопки показать, для пальцетыканья int KeyWidth=(X2-X1+2)/12; #else int KeyWidth=(X2-X1-1)/12; #endif #if 1 //Maximus: на таблетках лучше бы все кнопки показать, для пальцетыканья if (KeyWidth<3) KeyWidth=3; #else if (KeyWidth<8) KeyWidth=8; #endif int X=MouseEvent->dwMousePosition.X-X1; if (X<KeyWidth*9) Key=X/KeyWidth; else Key=9+(X-KeyWidth*9)/(KeyWidth+1); for (;;) { GetInputRecord(&rec); if (rec.EventType==MOUSE_EVENT && !(rec.Event.MouseEvent.dwButtonState & 3)) break; } if (rec.Event.MouseEvent.dwMousePosition.X<X1 || rec.Event.MouseEvent.dwMousePosition.X>X2 || rec.Event.MouseEvent.dwMousePosition.Y!=Y1) return FALSE; int NewKey,NewX=MouseEvent->dwMousePosition.X-X1; if (NewX<KeyWidth*9) NewKey=NewX/KeyWidth; else NewKey=9+(NewX-KeyWidth*9)/(KeyWidth+1); if (Key!=NewKey) return FALSE; if (Key>11) Key=11; if (MouseEvent->dwControlKeyState & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED) || (MouseEvent->dwButtonState & RIGHTMOST_BUTTON_PRESSED)) { if (MouseEvent->dwControlKeyState & SHIFT_PRESSED) Key+=KEY_ALTSHIFTF1; else if (MouseEvent->dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)) Key+=KEY_CTRLALTF1; else Key+=KEY_ALTF1; } else if (MouseEvent->dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)) { if (MouseEvent->dwControlKeyState & SHIFT_PRESSED) Key+=KEY_CTRLSHIFTF1; else Key+=KEY_CTRLF1; } else if (MouseEvent->dwControlKeyState & SHIFT_PRESSED) Key+=KEY_SHIFTF1; else Key+=KEY_F1; //if (Owner) //Owner->ProcessKey(Key); FrameManager->ProcessKey(Key); return TRUE; }