ANGLETest::~ANGLETest() { SafeDelete(mEGLWindow); }
virtual void TearDown() { SafeDelete(mTranslator); }
void Effects::DestroyAll() { SafeDelete(BasicFX); SafeDelete(BlurFX); SafeDelete(TessellationFX); }
BDF2Integrator::~BDF2Integrator(void) { SafeDelete(m_pPrecondMatrix); }
void TexturePacker::PackToMultipleTextures(const char * excludeFolder, const char* outputPath, std::list<DefinitionFile*> & defList) { if (defList.size() != 1) if (CommandLineParser::Instance()->GetVerbose())printf("* ERROR: failed to pack to multiple textures\n"); for (int i = 0; i < (int)sortVector.size(); ++i) { DefinitionFile * defFile = sortVector[i].defFile; int frame = sortVector[i].frameIndex; if (CommandLineParser::Instance()->GetVerbose())printf("[MultiPack] prepack: %s frame: %d w:%d h:%d\n", defFile->filename.c_str(), frame, defFile->frameRects[frame].dx, defFile->frameRects[frame].dy); } std::vector<ImagePacker*> & packers = usedPackers; /* // OLD PACKING ALGORITHM ImagePacker * currentPacker = new ImagePacker(Rect2i::Make(0, 0, 1024, 1024)); packers.push_back(currentPacker); // Packing of sorted by size images for (int i = 0; i < sortVector.size(); ++i) { DefinitionFile * defFile = sortVector[i].defFile; int frame = sortVector[i].frameIndex; printf("[MultiPack] pack: %s frame: %d w:%d h:%d\n", defFile->filename.c_str(), frame, defFile->frameRects[frame].dx, defFile->frameRects[frame].dy); bool packed = false; for (int packerIndex = 0; packerIndex < packers.size(); ++packerIndex) { if (packers[packerIndex]->AddImage(Size2i::Make(defFile->frameRects[frame].dx, defFile->frameRects[frame].dy), &defFile->frameRects[frame])) { packed = true; printf("[MultiPack] added to packer: %d\n", packerIndex); break; } } if (!packed) { currentPacker = new ImagePacker(Rect2i::Make(0, 0, 1024, 1024)); packers.push_back(currentPacker); if (!currentPacker->AddImage(Size2i::Make(defFile->frameRects[frame].dx, defFile->frameRects[frame].dy), &defFile->frameRects[frame])) { printf("*** FATAL ERROR: image is too big: imageSize: %d, %d\n", defFile->frameRects[frame].dx, defFile->frameRects[frame].dy); return; }else { printf("[MultiPack] added to packer: %d\n", packers.size() - 1); } } } */ /* // ALGO #2 std::vector<SizeSortItem> sortVectorWork = sortVector; while(sortVectorWork.size() > 0) { // try to pack for each resolution int maxPackedObjects = 0; //int bestResolution = 1025 * 1025; printf("* Packing tries started: "); ImagePacker * bestPackerForThisStep = 0; std::vector<SizeSortItem> newWorkVector; for (int yResolution = 8; yResolution <= 1024; yResolution *= 2) for (int xResolution = 8; xResolution <= 1024; xResolution *= 2) { Rect2i textureRect = Rect2i::Make(0, 0, xResolution, yResolution); ImagePacker * packer = new ImagePacker(textureRect); std::vector<SizeSortItem> tempSortVector = sortVectorWork; int n = TryToPackFromSortVector(packer, tempSortVector); if (n > maxPackedObjects) { maxPackedObjects = n; SafeDelete(bestPackerForThisStep); bestPackerForThisStep = packer; newWorkVector = tempSortVector; } } sortVectorWork = newWorkVector; packers.push_back(bestPackerForThisStep); } */ std::vector<SizeSortItem> sortVectorWork = sortVector; while(sortVectorWork.size() > 0) { // try to pack for each resolution float maxValue = 0.0f; //int bestResolution = 1025 * 1025; if (CommandLineParser::Instance()->GetVerbose())printf("* Packing tries started: "); ImagePacker * bestPackerForThisStep = 0; std::vector<SizeSortItem> newWorkVector; for (int yResolution = 8; yResolution <= maxTextureSize; yResolution *= 2) for (int xResolution = 8; xResolution <= maxTextureSize; xResolution *= 2) { if (CommandLineParser::Instance()->IsFlagSet("--pvr") && (xResolution != yResolution))continue; if ((onlySquareTextures) && (xResolution != yResolution))continue; Rect2i textureRect = Rect2i(0, 0, xResolution, yResolution); ImagePacker * packer = new ImagePacker(textureRect); std::vector<SizeSortItem> tempSortVector = sortVectorWork; float n = TryToPackFromSortVectorWeight(packer, tempSortVector); if (n > maxValue) { maxValue = n; SafeDelete(bestPackerForThisStep); bestPackerForThisStep = packer; newWorkVector = tempSortVector; } } sortVectorWork = newWorkVector; packers.push_back(bestPackerForThisStep); } if (CommandLineParser::Instance()->GetVerbose())printf("* Writing %d final textures \n", (int)packers.size()); std::vector<PngImageExt*> finalImages; for (int imageIndex = 0; imageIndex < (int)packers.size(); ++imageIndex) { PngImageExt * image = new PngImageExt(); ImagePacker * packer = packers[imageIndex]; image->Create(packer->GetRect().dx, packer->GetRect().dy); finalImages.push_back(image); } for (std::list<DefinitionFile*>::iterator defi = defList.begin(); defi != defList.end(); ++defi) { DefinitionFile * defFile = *defi; for (int frame = 0; frame < defFile->frameCount; ++frame) { Rect2i * destRect; ImagePacker * foundPacker = 0; int packerIndex = 0; char name[256]; for (packerIndex = 0; packerIndex < (int)packers.size(); ++packerIndex) { destRect = packers[packerIndex]->SearchRectForPtr(&defFile->frameRects[frame]); if (destRect) { foundPacker = packers[packerIndex]; std::string withoutExt = defFile->filename.substr(0, defFile->filename.length() - 4); snprintf(name, 256, "%s%d.png", withoutExt.c_str(), frame); break; } } if (foundPacker) { if (CommandLineParser::Instance()->GetVerbose())printf("[MultiPack] pack to texture: %d\n", packerIndex); PngImageExt image; image.Read(name); finalImages[packerIndex]->DrawImage(destRect->x, destRect->y, &image); if (CommandLineParser::Instance()->IsFlagSet("--debug")) { finalImages[packerIndex]->DrawRect(*destRect, 0xFF0000FF); } } } } for (int image = 0; image < (int)packers.size(); ++image) { char temp[256]; sprintf(temp, "texture%d.png", image); std::string textureName = std::string(outputPath) + std::string(temp); finalImages[image]->Write(textureName.c_str()); } for (std::list<DefinitionFile*>::iterator defi = defList.begin(); defi != defList.end(); ++defi) { DefinitionFile * defFile = *defi; std::string textureName = std::string(outputPath) + std::string("texture"); if (!WriteMultipleDefinition(excludeFolder, outputPath, "texture", defFile)) { printf("* ERROR: failed to write definition\n"); } } }
Button::~Button(void) { SafeDelete(m_btnImg); SafeDelete(m_spriteTexture); }
CHotKeyDialog::~CHotKeyDialog() { SafeDelete(mp_DpiAware); }
TheoraPlayer::~TheoraPlayer() { ReleaseData(); SafeDelete(theoraData); }
void ODERigidObject::Clear() { SafeDeleteProc(bodyID,dBodyDestroy); SafeDelete(geometry); }
WBPEGetState::~WBPEGetState() { SafeDelete( m_EntityPE ); }
void retro_deinit(void) { SafeDeleteArray(gearboy_frame_buf); SafeDelete(core); }
void Display::destroyContext(gl::Context *context) { mContextSet.erase(context); SafeDelete(context); }
CAppInterface::~CAppInterface() { SafeDelete(m_pServerApp); }
KVImpactParameter::~KVImpactParameter() { // Destructor SafeDelete(fIPScale); SafeDelete(fObsTransform); }
void Button::setImage( Texture *imgTex ) { SafeDelete(m_btnImg); m_btnImg = new Sprite(imgTex); }
EGLImageD3D::~EGLImageD3D() { SafeDelete(mRenderTarget); }
void Button::loadImage( const char* imgTexPath ) { SafeDelete(m_btnImg); m_btnImg = new Sprite(imgTexPath); }
SceneFactory::~SceneFactory() { SafeDelete(map); }
virtual ~MongodbObjectInternalData() { bson_destroy(object); SafeDelete(object); }
ActiveRecordField::~ActiveRecordField() { SafeDelete( mType ); }
ImplicitEulerIntegrator::~ImplicitEulerIntegrator(void) { SafeDelete(m_pPrecondMatrix); }
//析构函数 CGameFrameDlg::~CGameFrameDlg() { SafeDelete(m_pKernelSink); SafeDelete(m_pGameFrameControl); return; }
// ----------------------------------------------------------------------------- VideoView::~VideoView() { SafeDelete(m_timer); }
//============================================================================== /// //------------------------------------------------------------------------------ void Camera::cameraAllRelease() { for(auto& cam : _cameraList) { SafeDelete(cam); } _cameraList.clear(); }
CGameEventManager::~CGameEventManager() { int i; for( i=0; i<m_vecpGameEvent.size(); i++ ) SafeDelete( m_vecpGameEvent[i] ); }
//============================================================================== // //------------------------------------------------------------------------------ void Camera::releaseCamera(CameraBace* camera) { auto it = remove_if(_cameraList.begin(),_cameraList.end(),[camera](CameraEx* cam) {return camera == cam;}); _cameraList.erase(it); SafeDelete(camera); }
Shader::~Shader() { SafeDelete(mShader); }
INT_PTR WINAPI ConEmuAbout::aboutProc(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam) { INT_PTR lRc = 0; if ((mp_ImgBtn && mp_ImgBtn->Process(hDlg, messg, wParam, lParam, lRc)) || EditIconHint_Process(hDlg, messg, wParam, lParam, lRc)) { SetWindowLongPtr(hDlg, DWLP_MSGRESULT, lRc); return TRUE; } PatchMsgBoxIcon(hDlg, messg, wParam, lParam); switch (messg) { case WM_INITDIALOG: { gpConEmu->OnOurDialogOpened(); mh_AboutDlg = hDlg; _ASSERTE(mp_ImgBtn==NULL); SafeDelete(mp_ImgBtn); mp_ImgBtn = new CImgButtons(hDlg, pIconCtrl, IDOK); mp_ImgBtn->AddDonateButtons(); if (mp_DpiAware) { mp_DpiAware->Attach(hDlg, ghWnd, CDynDialog::GetDlgClass(hDlg)); } CDpiAware::CenterDialog(hDlg); if ((ghOpWnd && IsWindow(ghOpWnd)) || (WS_EX_TOPMOST & GetWindowLongPtr(ghWnd, GWL_EXSTYLE))) { SetWindowPos(hDlg, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE); } LPCWSTR pszActivePage = (LPCWSTR)lParam; wchar_t* pszTitle = lstrmerge(gpConEmu->GetDefaultTitle(), L" About"); if (pszTitle) { SetWindowText(hDlg, pszTitle); SafeFree(pszTitle); } if (hClassIcon) { SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hClassIcon); SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)CreateNullIcon()); SetClassLongPtr(hDlg, GCLP_HICON, (LONG_PTR)hClassIcon); } SetDlgItemText(hDlg, stConEmuAbout, pAboutTitle); SetDlgItemText(hDlg, stConEmuUrl, gsHomePage); EditIconHint_Set(hDlg, GetDlgItem(hDlg, tAboutSearch), true, L"Search", false, UM_SEARCH, IDOK); EditIconHint_Subclass(hDlg); wchar_t* pszLabel = GetDlgItemTextPtr(hDlg, stConEmuVersion); if (pszLabel) { wchar_t* pszSet = NULL; if (gpUpd) { wchar_t* pszVerInfo = gpUpd->GetCurVerInfo(); if (pszVerInfo) { pszSet = lstrmerge(pszLabel, L" ", pszVerInfo); free(pszVerInfo); } } if (!pszSet) { pszSet = lstrmerge(pszLabel, L" ", L"Please check for updates manually"); } if (pszSet) { SetDlgItemText(hDlg, stConEmuVersion, pszSet); free(pszSet); } free(pszLabel); } HWND hTab = GetDlgItem(hDlg, tbAboutTabs); INT_PTR nPage = -1; for (size_t i = 0; i < countof(Pages); i++) { TCITEM tie = {}; tie.mask = TCIF_TEXT; tie.pszText = (LPWSTR)Pages[i].Title; TabCtrl_InsertItem(hTab, i, &tie); if (pszActivePage && (lstrcmpi(pszActivePage, Pages[i].Title) == 0)) nPage = i; } if (nPage >= 0) { TabSelected(hDlg, nPage); TabCtrl_SetCurSel(hTab, (int)nPage); } else if (!pszActivePage) { TabSelected(hDlg, 0); } else { _ASSERTE(pszActivePage==NULL && "Unknown page name?"); } SetFocus(hTab); return FALSE; } case WM_CTLCOLORSTATIC: if (GetWindowLongPtr((HWND)lParam, GWLP_ID) == stConEmuUrl) { SetTextColor((HDC)wParam, GetSysColor(COLOR_HOTLIGHT)); HBRUSH hBrush = GetSysColorBrush(COLOR_3DFACE); SetBkMode((HDC)wParam, TRANSPARENT); return (INT_PTR)hBrush; } else { SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); HBRUSH hBrush = GetSysColorBrush(COLOR_3DFACE); SetBkMode((HDC)wParam, TRANSPARENT); return (INT_PTR)hBrush; } break; case WM_SETCURSOR: { if (GetWindowLongPtr((HWND)wParam, GWLP_ID) == stConEmuUrl) { SetCursor(LoadCursor(NULL, IDC_HAND)); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, TRUE); return TRUE; } return FALSE; } break; case WM_COMMAND: switch (HIWORD(wParam)) { case BN_CLICKED: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: case IDCLOSE: aboutProc(hDlg, WM_CLOSE, 0, 0); return 1; case stConEmuUrl: ConEmuAbout::OnInfo_HomePage(); return 1; } // BN_CLICKED break; case EN_SETFOCUS: switch (LOWORD(wParam)) { case tAboutText: { // Do not autosel all text HWND hEdit = (HWND)lParam; DWORD nStart = 0, nEnd = 0; SendMessage(hEdit, EM_GETSEL, (WPARAM)&nStart, (LPARAM)&nEnd); if (nStart != nEnd) { SendMessage(hEdit, EM_SETSEL, nTextSelStart, nTextSelEnd); } } break; } } // switch (HIWORD(wParam)) break; case WM_NOTIFY: { LPNMHDR nmhdr = (LPNMHDR)lParam; if ((nmhdr->code == TCN_SELCHANGE) && (nmhdr->idFrom == tbAboutTabs)) { int iPage = TabCtrl_GetCurSel(nmhdr->hwndFrom); if ((iPage >= 0) && (iPage < (int)countof(Pages))) TabSelected(hDlg, iPage); } break; } case UM_SEARCH: searchProc(hDlg, (HWND)lParam, false); break; case UM_EDIT_KILL_FOCUS: SendMessage((HWND)lParam, EM_GETSEL, (WPARAM)&nTextSelStart, (LPARAM)&nTextSelEnd); break; case WM_CLOSE: //if (ghWnd == NULL) gpConEmu->OnOurDialogClosed(); if (mp_DpiAware) mp_DpiAware->Detach(); EndDialog(hDlg, IDOK); SafeDelete(mp_ImgBtn); break; case WM_DESTROY: mh_AboutDlg = NULL; break; default: if (mp_DpiAware && mp_DpiAware->ProcessDpiMessages(hDlg, messg, wParam, lParam)) { return TRUE; } } return FALSE; }
//// Эта функция пайп не закрывает! //void CGuiServer::GuiServerThreadCommand(HANDLE hPipe) BOOL CGuiServer::GuiServerCommand(LPVOID pInst, CESERVER_REQ* pIn, CESERVER_REQ* &ppReply, DWORD &pcbReplySize, DWORD &pcbMaxReplySize, LPARAM lParam) { BOOL lbRc = FALSE; CGuiServer* pGSrv = (CGuiServer*)lParam; if (!pGSrv) { _ASSERTE(((CGuiServer*)lParam)!=NULL); pGSrv = &gpConEmu->m_GuiServer; } if (pIn->hdr.bAsync) pGSrv->mp_GuiServer->BreakConnection(pInst); gpSetCls->debugLogCommand(pIn, TRUE, timeGetTime(), 0, pGSrv ? pGSrv->ms_ServerPipe : NULL); #ifdef _DEBUG UINT nDataSize = pIn->hdr.cbSize - sizeof(CESERVER_REQ_HDR); #endif // Все данные из пайпа получены, обрабатываем команду и возвращаем (если нужно) результат #ifdef ALLOW_WINE_MSG if (gbIsWine) { wchar_t szMsg[128]; msprintf(szMsg, countof(szMsg), L"CGuiServer::GuiServerCommand.\nGUI TID=%u\nSrcPID=%u, SrcTID=%u, Cmd=%u", GetCurrentThreadId(), pIn->hdr.nSrcPID, pIn->hdr.nSrcThreadId, pIn->hdr.nCmd); MessageBox(szMsg, MB_ICONINFORMATION); } #endif switch (pIn->hdr.nCmd) { case CECMD_NEWCMD: { // Приходит из другой копии ConEmu.exe, когда она запущена с ключом /single, /showhide, /showhideTSA DEBUGSTR(L"GUI recieved CECMD_NEWCMD\n"); if (gpSetCls->isAdvLogging) { size_t cchAll = 120 + _tcslen(pIn->NewCmd.szConEmu) + _tcslen(pIn->NewCmd.szCurDir) + _tcslen(pIn->NewCmd.szCommand); wchar_t* pszInfo = (wchar_t*)malloc(cchAll*sizeof(*pszInfo)); if (pszInfo) { _wsprintf(pszInfo, SKIPLEN(cchAll) L"CECMD_NEWCMD: Wnd=x%08X, Act=%u, ConEmu=%s, Dir=%s, Cmd=%s", (DWORD)(DWORD_PTR)pIn->NewCmd.hFromConWnd, pIn->NewCmd.ShowHide, pIn->NewCmd.szConEmu, pIn->NewCmd.szCurDir, pIn->NewCmd.szCommand); gpConEmu->LogString(pszInfo); free(pszInfo); } } BOOL bAccepted = FALSE; if (pIn->NewCmd.szConEmu[0]) { bAccepted = (lstrcmpi(gpConEmu->ms_ConEmuExeDir, pIn->NewCmd.szConEmu) == 0); } else { bAccepted = TRUE; } if (bAccepted) { bool bCreateTab = (pIn->NewCmd.ShowHide == sih_None || pIn->NewCmd.ShowHide == sih_StartDetached); gpConEmu->OnMinimizeRestore(bCreateTab ? sih_SetForeground : pIn->NewCmd.ShowHide); // Может быть пусто if (bCreateTab && pIn->NewCmd.szCommand[0]) { RConStartArgs *pArgs = new RConStartArgs; pArgs->bDetached = (pIn->NewCmd.ShowHide == sih_StartDetached); pArgs->pszSpecialCmd = lstrdup(pIn->NewCmd.szCommand); if (pIn->NewCmd.szCurDir[0] == 0) { _ASSERTE(pIn->NewCmd.szCurDir[0] != 0); } else { pArgs->pszStartupDir = lstrdup(pIn->NewCmd.szCurDir); } if (gpSet->isMulti || CVConGroup::isDetached()) { gpConEmu->PostCreateCon(pArgs); } else { // Если хотят в одном окне - только одну консоль gpConEmu->CreateWnd(pArgs); SafeDelete(pArgs); } } else { _ASSERTE(pIn->NewCmd.ShowHide==sih_ShowMinimize || pIn->NewCmd.ShowHide==sih_ShowHideTSA || pIn->NewCmd.ShowHide==sih_Show); } } pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(BYTE); lbRc = ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize); if (lbRc) { ppReply->Data[0] = bAccepted; } break; } //CECMD_NEWCMD case CECMD_TABSCMD: { // 0: спрятать/показать табы, 1: перейти на следующую, 2: перейти на предыдущую, 3: commit switch DEBUGSTR(L"GUI recieved CECMD_TABSCMD\n"); _ASSERTE(nDataSize>=1); DWORD nTabCmd = pIn->Data[0]; gpConEmu->TabCommand((ConEmuTabCommand)nTabCmd); pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(BYTE); if (ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) { lbRc = TRUE; ppReply->Data[0] = TRUE; } break; } // CECMD_TABSCMD #if 0 case CECMD_GETALLTABS: { int nConCount = gpConEmu->GetConCount(); int nActiveCon = gpConEmu->ActiveConNum(); size_t cchMax = nConCount*16; size_t cchCount = 0; CVirtualConsole* pVCon; CESERVER_REQ_GETALLTABS::TabInfo* pTabs = (CESERVER_REQ_GETALLTABS::TabInfo*)calloc(cchMax, sizeof(*pTabs)); for (int V = 0; (pVCon = gpConEmu->GetVCon(V)) != NULL; V++) { if (!pTabs) { _ASSERTE(pTabs!=NULL); break; } CRealConsole* pRCon = pVCon->RCon(); if (!pRCon) continue; ConEmuTab tab; wchar_t szModified[4]; for (int T = 0; pRCon->GetTab(T, &tab); T++) { if (cchCount >= cchMax) { pTabs = (CESERVER_REQ_GETALLTABS::TabInfo*)realloc(pTabs, (cchMax+32)*sizeof(*pTabs)); if (!pTabs) { _ASSERTE(pTabs!=NULL); break; } cchMax += 32; _ASSERTE(cchCount<cchMax); } pTabs[cchCount].ActiveConsole == (V == nActiveCon); pTabs[cchCount].ActiveTab == (tab.Current != 0); pTabs[cchCount].Disabled = ((tab.Type & fwt_Disabled) == fwt_Disabled); pTabs[cchCount].ConsoleIdx = V; pTabs[cchCount].TabIdx = T; // Text wcscpy_c(szModified, tab.Modified ? L" * " : L" "); if (V == nActiveCon) { if (T < 9) _wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/&%i]%s", V+1, T+1, szModified); else if (T == 9) _wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/1&0]%s", V+1, szModified); else _wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/%i]%s", V+1, T+1, szModified); } else { _wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/%i]%s", V+1, T+1, szModified); } cchCount++; } } if (cchCount && pTabs) { pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(CESERVER_REQ_GETALLTABS)+((cchCount-1)*sizeof(CESERVER_REQ_GETALLTABS::TabInfo)); if (ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) { lbRc = TRUE; ppReply->GetAllTabs.Count = cchCount; memmove(ppReply->GetAllTabs.Tabs, pTabs, cchCount*sizeof(*pTabs)); } } SafeFree(pTabs); break; } // CECMD_GETALLTABS case CECMD_ACTIVATETAB: { BOOL lbTabOk = FALSE; CVirtualConsole *pVCon = gpConEmu->GetVCon(pIn->dwData[0]); if (pVCon && pVCon->RCon()) { lbTabOk = pVCon->RCon()->ActivateFarWindow(pIn->dwData[1]); } pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(DWORD); if (ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) { lbRc = TRUE; ppReply->dwData[0] = lbTabOk; } break; } // CECMD_ACTIVATETAB #endif case CECMD_ATTACH2GUI: { // Получен запрос на Attach из сервера pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(CESERVER_REQ_STARTSTOPRET); if (!ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) goto wrap; //CESERVER_REQ* pOut = ExecuteNewCmd(CECMD_ATTACH2GUI, sizeof(CESERVER_REQ_HDR)+sizeof(CESERVER_REQ_STARTSTOPRET)); gpConEmu->AttachRequested(pIn->StartStop.hWnd, &(pIn->StartStop), &(ppReply->StartStopRet)); _ASSERTE((ppReply->StartStopRet.nBufferHeight == 0) || ((int)ppReply->StartStopRet.nBufferHeight > pIn->StartStop.sbi.dwSize.X)); lbRc = TRUE; //ExecuteFreeResult(pOut); break; } // CECMD_ATTACH2GUI case CECMD_SRVSTARTSTOP: { pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(CESERVER_REQ_STARTSTOPRET); if (!ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) goto wrap; if (pIn->SrvStartStop.Started == srv_Started) { // Запущен процесс сервера HWND hConWnd = (HWND)pIn->dwData[1]; _ASSERTE(hConWnd && IsWindow(hConWnd)); DWORD nStartTick = timeGetTime(); //LRESULT l = 0; //DWORD_PTR dwRc = 0; //2010-05-21 Поскольку это критично - лучше ждать до упора, хотя может быть DeadLock? //l = SendMessageTimeout(ghWnd, gpConEmu->mn_MsgSrvStarted, (WPARAM)hConWnd, pIn->hdr.nSrcPID, // SMTO_BLOCK, 5000, &dwRc); //111002 - вернуть должен HWND окна отрисовки (дочернее окно ConEmu) MsgSrvStartedArg arg = {hConWnd, pIn->hdr.nSrcPID, pIn->SrvStartStop.dwKeybLayout, nStartTick}; SendMessage(ghWnd, gpConEmu->mn_MsgSrvStarted, 0, (LPARAM)&arg); HWND hWndDC = arg.hWndDc; HWND hWndBack = arg.hWndBack; _ASSERTE(hWndDC!=NULL); #ifdef _DEBUG DWORD dwErr = GetLastError(), nEndTick = timeGetTime(), nDelta = nEndTick - nStartTick; if (hWndDC && nDelta >= EXECUTE_CMD_WARN_TIMEOUT) { if (!IsDebuggerPresent()) { //_ASSERTE(nDelta <= EXECUTE_CMD_WARN_TIMEOUT || (pIn->hdr.nCmd == CECMD_CMDSTARTSTOP && nDelta <= EXECUTE_CMD_WARN_TIMEOUT2)); _ASSERTEX(nDelta <= EXECUTE_CMD_WARN_TIMEOUT); } } #endif //pIn->dwData[0] = (DWORD)ghWnd; //-V205 //pIn->dwData[1] = (DWORD)dwRc; //-V205 //pIn->dwData[0] = (l == 0) ? 0 : 1; ppReply->StartStopRet.hWnd = ghWnd; ppReply->StartStopRet.hWndDc = hWndDC; ppReply->StartStopRet.hWndBack = hWndBack; ppReply->StartStopRet.dwPID = GetCurrentProcessId(); } else if (pIn->SrvStartStop.Started == srv_Stopped) { // Процесс сервера завершается CRealConsole* pRCon = NULL; CVConGuard VCon; for (size_t i = 0;; i++) { if (!CVConGroup::GetVCon(i, &VCon)) break; pRCon = VCon->RCon(); if (pRCon && (pRCon->GetServerPID(true) == pIn->hdr.nSrcPID || pRCon->GetServerPID(false) == pIn->hdr.nSrcPID)) { break; } pRCon = NULL; } if (pRCon) pRCon->OnServerClosing(pIn->hdr.nSrcPID); //pIn->dwData[0] = 1; } else { _ASSERTE((pIn->dwData[0] == 1) || (pIn->dwData[0] == 101)); } lbRc = TRUE; //// Отправляем //fSuccess = WriteFile( // hPipe, // handle to pipe // pOut, // buffer to write from // pOut->hdr.cbSize, // number of bytes to write // &cbWritten, // number of bytes written // NULL); // not overlapped I/O //ExecuteFreeResult(pOut); break; } // CECMD_SRVSTARTSTOP case CECMD_ASSERT: { DWORD nBtn = MessageBox(NULL, pIn->AssertInfo.szDebugInfo, pIn->AssertInfo.szTitle, pIn->AssertInfo.nBtns); pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(DWORD); if (ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) { lbRc = TRUE; ppReply->dwData[0] = nBtn; } //ExecutePrepareCmd(&pIn->hdr, CECMD_ASSERT, sizeof(CESERVER_REQ_HDR) + sizeof(DWORD)); //pIn->dwData[0] = nBtn; //// Отправляем //fSuccess = WriteFile( // hPipe, // handle to pipe // pIn, // buffer to write from // pIn->hdr.cbSize, // number of bytes to write // &cbWritten, // number of bytes written // NULL); // not overlapped I/O break; } // CECMD_ASSERT case CECMD_ATTACHGUIAPP: { pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(CESERVER_REQ_ATTACHGUIAPP); if (!ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) goto wrap; ppReply->AttachGuiApp = pIn->AttachGuiApp; //CESERVER_REQ Out; //ExecutePrepareCmd(&Out.hdr, CECMD_ATTACHGUIAPP, sizeof(CESERVER_REQ_HDR)+sizeof(Out.AttachGuiApp)); //Out.AttachGuiApp = pIn->AttachGuiApp; #ifdef SHOW_GUIATTACH_START if (pIn->AttachGuiApp.hWindow == NULL) { wchar_t szDbg[1024]; _wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"AttachGuiApp requested from:\n%s\nPID=%u", pIn->AttachGuiApp.sAppFileName, pIn->AttachGuiApp.nPID); //MBoxA(szDbg); MessageBox(NULL, szDbg, L"ConEmu", MB_SYSTEMMODAL); } #endif // Уведомить ожидающую вкладку CRealConsole* pRCon = gpConEmu->AttachRequestedGui(pIn->AttachGuiApp.sAppFileName, pIn->AttachGuiApp.nPID); if (pRCon) { CVConGuard VCon(pRCon->VCon()); RECT rcPrev = ppReply->AttachGuiApp.rcWindow; HWND hBack = pRCon->VCon()->GetBack(); //// Размер должен быть независим от возможности наличия прокрутки в VCon //GetWindowRect(hBack, &ppReply->AttachGuiApp.rcWindow); //ppReply->AttachGuiApp.rcWindow.right -= ppReply->AttachGuiApp.rcWindow.left; //ppReply->AttachGuiApp.rcWindow.bottom -= ppReply->AttachGuiApp.rcWindow.top; //ppReply->AttachGuiApp.rcWindow.left = ppReply->AttachGuiApp.rcWindow.top = 0; ////MapWindowPoints(NULL, hBack, (LPPOINT)&ppReply->AttachGuiApp.rcWindow, 2); //pRCon->CorrectGuiChildRect(ppReply->AttachGuiApp.nStyle, ppReply->AttachGuiApp.nStyleEx, ppReply->AttachGuiApp.rcWindow); // Уведомить RCon и ConEmuC, что гуй подцепился // Вызывается два раза. Первый (при запуске exe) ahGuiWnd==NULL, второй - после фактического создания окна pRCon->SetGuiMode(pIn->AttachGuiApp.nFlags, pIn->AttachGuiApp.hAppWindow, pIn->AttachGuiApp.Styles.nStyle, pIn->AttachGuiApp.Styles.nStyleEx, pIn->AttachGuiApp.sAppFileName, pIn->AttachGuiApp.nPID, rcPrev); ppReply->AttachGuiApp.nFlags = agaf_Success | (pRCon->isActive(false) ? 0 : agaf_Inactive); ppReply->AttachGuiApp.nPID = pRCon->GetServerPID(); ppReply->AttachGuiApp.hConEmuDc = pRCon->GetView(); ppReply->AttachGuiApp.hConEmuBack = hBack; ppReply->AttachGuiApp.hConEmuWnd = ghWnd; ppReply->AttachGuiApp.hAppWindow = pIn->AttachGuiApp.hAppWindow; ppReply->AttachGuiApp.hSrvConWnd = pRCon->ConWnd(); ppReply->AttachGuiApp.hkl = (DWORD)(LONG)(LONG_PTR)GetKeyboardLayout(gpConEmu->mn_MainThreadId); ZeroStruct(ppReply->AttachGuiApp.Styles.Shifts); CRealConsole::CorrectGuiChildRect(pIn->AttachGuiApp.Styles.nStyle, pIn->AttachGuiApp.Styles.nStyleEx, ppReply->AttachGuiApp.Styles.Shifts); } else { ppReply->AttachGuiApp.nFlags = agaf_Fail; } lbRc = TRUE; //// Отправляем //fSuccess = WriteFile( // hPipe, // handle to pipe // &Out, // buffer to write from // Out.hdr.cbSize, // number of bytes to write // &cbWritten, // number of bytes written // NULL); // not overlapped I/O break; } // CECMD_ATTACHGUIAPP case CECMD_GUICLIENTSHIFT: { pcbReplySize = sizeof(CESERVER_REQ_HDR)+sizeof(GuiStylesAndShifts); if (!ExecuteNewCmd(ppReply, pcbMaxReplySize, pIn->hdr.nCmd, pcbReplySize)) goto wrap; ppReply->GuiAppShifts = pIn->GuiAppShifts; ZeroStruct(ppReply->GuiAppShifts.Shifts); CRealConsole::CorrectGuiChildRect(pIn->GuiAppShifts.nStyle, pIn->GuiAppShifts.nStyleEx, ppReply->GuiAppShifts.Shifts); lbRc = TRUE; break; } // CECMD_GUICLIENTSHIFT } //// Освободить память //if (pIn && (LPVOID)pIn != (LPVOID)&in) //{ // free(pIn); pIn = NULL; //} wrap: return lbRc; }
void Effects::DestroyAll() { SafeDelete(BasicFX); SafeDelete(SubdivisionFX); }