本文整理汇总了C++中CVConGuard类的典型用法代码示例。如果您正苦于以下问题:C++ CVConGuard类的具体用法?C++ CVConGuard怎么用?C++ CVConGuard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CVConGuard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RaiseTestException
void ConEmuAbout::OnInfo_ThrowTrapException(bool bMainThread)
{
if (bMainThread)
{
if (MsgBox(L"Are you sure?\nApplication will terminates after that!\nThrow exception in ConEmu's main thread?", MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2)==IDYES)
{
//#ifdef _DEBUG
//MyAssertTrap();
//#else
//DebugBreak();
//#endif
// -- trigger division by 0
RaiseTestException();
}
}
else
{
if (MsgBox(L"Are you sure?\nApplication will terminates after that!\nThrow exception in ConEmu's monitor thread?", MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2)==IDYES)
{
CVConGuard VCon;
if ((gpConEmu->GetActiveVCon(&VCon) >= 0) && VCon->RCon())
VCon->RCon()->MonitorAssertTrap();
}
}
}
示例2: ChooseTabFromMenu
void CConEmuCtrl::ChooseTabFromMenu(BOOL abFirstTabOnly, POINT pt, DWORD Align /*= TPM_CENTERALIGN|TPM_VCENTERALIGN*/)
{
HMENU hPopup = gpConEmu->mp_Menu->CreateVConListPopupMenu(NULL, abFirstTabOnly);
if (!Align)
Align = TPM_LEFTALIGN|TPM_TOPALIGN;
int nTab = gpConEmu->mp_Menu->trackPopupMenu(tmp_TabsList, hPopup, Align|TPM_RETURNCMD,
pt.x, pt.y, ghWnd);
if (nTab >= IDM_VCON_FIRST && nTab <= IDM_VCON_LAST)
{
int nNewV = ((int)HIWORD(nTab))-1;
int nNewR = ((int)LOWORD(nTab))-1;
CVConGuard VCon;
if (CVConGroup::GetVCon(nNewV, &VCon))
{
CRealConsole* pRCon = VCon->RCon();
if (pRCon)
{
CTab tab(__FILE__,__LINE__);
if (pRCon->GetTab(nNewR, tab))
pRCon->ActivateFarWindow(tab->Info.nFarWindowID);
}
if (!VCon->isActive(false))
gpConEmu->Activate(VCon.VCon());
}
}
DestroyMenu(hPopup);
}
示例3: CountActiveTabs
int CTabBarClass::CountActiveTabs(int nMax /*= 0*/)
{
int nTabs = 0;
bool bHideInactiveConsoleTabs = gpSet->bHideInactiveConsoleTabs;
for (int V = 0; V < MAX_CONSOLE_COUNT; V++)
{
CVConGuard guard;
if (!CVConGroup::GetVCon(V, &guard))
continue;
CVirtualConsole* pVCon = guard.VCon();
if (bHideInactiveConsoleTabs)
{
if (!pVCon->isVisible())
continue;
}
nTabs += pVCon->RCon()->GetTabCount(TRUE);
if ((nMax > 0) && (nTabs >= nMax))
break;
}
return nTabs;
}
示例4: SetForegroundWindow
void CEFindDlg::FindTextDialog()
{
if (mh_FindDlg && IsWindow(mh_FindDlg))
{
SetForegroundWindow(mh_FindDlg);
return;
}
CVConGuard VCon;
CRealConsole* pRCon = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon->RCon() : NULL;
// Создаем диалог поиска только для консольных приложений
if (!pRCon || (pRCon->GuiWnd() && !pRCon->isBufferHeight()) || !pRCon->GetView())
{
//DisplayLastError(L"No RealConsole, nothing to find");
return;
}
gpConEmu->SkipOneAppsRelease(true);
mh_FindDlg = CreateDialogParam((HINSTANCE)GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_FIND), ghWnd, findTextProc, 0/*Param*/);
if (!mh_FindDlg)
{
DisplayLastError(L"Can't create Find text dialog", GetLastError());
}
}
示例5: tab
bool CTabBarClass::GetVConFromTab(int nTabIdx, CVConGuard* rpVCon, DWORD* rpWndIndex)
{
bool lbRc = false;
CTab tab(__FILE__,__LINE__);
CVConGuard VCon;
DWORD wndIndex = 0;
if (m_Tabs.GetTabByIndex(nTabIdx, tab))
{
wndIndex = tab->Info.nFarWindowID;
if (!gpConEmu->isValid((CVirtualConsole*)tab->Info.pVCon))
{
RequestPostUpdate();
}
else
{
VCon = (CVirtualConsole*)tab->Info.pVCon;
lbRc = true;
}
}
if (rpVCon)
rpVCon->Attach(VCon.VCon());
if (rpWndIndex)
*rpWndIndex = lbRc ? wndIndex : 0;
return lbRc;
}
示例6: ProcessMove
// This function is called throughout the duration of the panning/inertia gesture
bool CGestures::ProcessMove(HWND hWnd, const LONG ldx, const LONG ldy)
{
bool lbSent = false;
if (ldy)
{
CVConGuard VCon;
CRealConsole* pRCon = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon->RCon() : NULL;
if (pRCon)
{
TODO("Если можно будет задавать разный шрифт для разных консолей - заменить gpSet->FontSizeY");
// Соотнести Pan с высотой шрифта
int dy = ((ldy < 0) ? -ldy : ldy) / gpSet->FontSizeY;
if (dy > 0)
{
short Delta = ((ldy < 0) ? -120 : 120) * dy;
#ifdef _DEBUG
wchar_t szDbg[128]; _wsprintf(szDbg, SKIPLEN(countof(szDbg)) L" ProcessMove(%i,%i), WheelDelta=%i\n", ldx, ldy, (int)Delta);
DEBUGSTRPAN(szDbg);
#endif
POINT pt = _ptBegin;
if (hWnd != VCon->GetView())
MapWindowPoints(hWnd, VCon->GetView(), &pt, 1);
pRCon->OnMouse(WM_MOUSEWHEEL, MAKELPARAM(0,Delta), pt.x, pt.y, true, true);
lbSent = true; // Запомнить обработанную координату
}
}
}
return lbSent;
}
示例7: key_WinSize
// Общая для key_WinWidthDec/key_WinWidthInc/key_WinHeightDec/key_WinHeightInc
// pRCon may be NULL
bool CConEmuCtrl::key_WinSize(BYTE vk)
{
if (gpConEmu->isFullScreen() || gpConEmu->isZoomed() || gpConEmu->isIconic())
{
// ничего не делать
}
else
{
CVConGuard VCon;
CVirtualConsole* pVCon = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon.VCon() : NULL;
RECT rcWindow = {};
if (GetWindowRect(ghWnd, &rcWindow))
{
RECT rcMon = gpConEmu->CalcRect(CER_MONITOR, rcWindow, CER_MONITOR, pVCon);
int nX = gpSetCls->FontWidth();
int nY = gpSetCls->FontHeight();
if (vk == VK_LEFT)
{
rcWindow.right = rcWindow.right - nX;
}
else if (vk == VK_RIGHT)
{
if ((rcWindow.right + nX) < rcMon.right)
rcWindow.right = rcWindow.right + nX;
}
else if (vk == VK_UP)
{
rcWindow.bottom = rcWindow.bottom - nY;
}
else if (vk == VK_DOWN)
{
if ((rcWindow.bottom + nY) < rcMon.bottom)
rcWindow.bottom = rcWindow.bottom + nY;
}
if (rcWindow.right > rcWindow.left && rcWindow.bottom > rcWindow.top)
{
MoveWindowRect(ghWnd, rcWindow, TRUE);
}
}
//
//CRealConsole* pRCon = pVCon ? pVCon->RCon() : NULL;
//if (pRCon)
//{
//
// //if (!pRCon->GuiWnd())
// //{
// //
// //}
// //else
// //{
// // // Ресайз в ГУИ режиме
// //}
//}
}
return true;
}
示例8: InsideUpdateDir
void CConEmuInside::InsideUpdateDir()
{
CVConGuard VCon;
if (mh_InsideParentPath && IsWindow(mh_InsideParentPath) && (gpConEmu->GetActiveVCon(&VCon) >= 0) && VCon->RCon())
{
wchar_t szCurText[512] = {};
DWORD_PTR lRc = 0;
if (SendMessageTimeout(mh_InsideParentPath, WM_GETTEXT, countof(szCurText), (LPARAM)szCurText, SMTO_ABORTIFHUNG|SMTO_NORMAL, 300, &lRc))
{
if (gnOsVer < 0x600)
{
// Если в заголовке нет полного пути
if (wcschr(szCurText, L'\\') == NULL)
{
// Сразу выходим
return;
}
}
LPCWSTR pszPath = NULL;
// Если тут уже путь - то префикс не отрезать
if ((szCurText[0] == L'\\' && szCurText[1] == L'\\' && szCurText[2]) // сетевой путь
|| (szCurText[0] && szCurText[1] == L':' && szCurText[2] == L'\\' /*&& szCurText[3]*/)) // Путь через букву диска
{
pszPath = szCurText;
}
else
{
// Иначе - отрезать префикс. На английской винде это "Address: D:\dir1\dir2"
pszPath = wcschr(szCurText, L':');
if (pszPath)
pszPath = SkipNonPrintable(pszPath+1);
}
// Если успешно - сравниваем с ms_InsideParentPath
if (pszPath && *pszPath && (lstrcmpi(ms_InsideParentPath, pszPath) != 0))
{
int nLen = lstrlen(pszPath);
if (nLen >= (int)countof(ms_InsideParentPath))
{
_ASSERTE((nLen<countof(ms_InsideParentPath)) && "Too long path?");
}
else //if (VCon->RCon())
{
// Запомнить для сравнения
lstrcpyn(ms_InsideParentPath, pszPath, countof(ms_InsideParentPath));
// Подготовить команду для выполнения в Shell
VCon->RCon()->PostPromptCmd(true, pszPath);
}
}
}
}
}
示例9: DoEndFindText
void CConEmuCtrl::DoEndFindText(CRealConsole* pRCon /*= NULL*/)
{
CVConGuard VCon;
if (!pRCon)
{
pRCon = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon->RCon() : NULL;
if (!pRCon)
return;
}
pRCon->DoEndFindText();
}
示例10: key_ChildSystemMenu
bool CConEmuCtrl::key_ChildSystemMenu(const ConEmuChord& VkState, bool TestOnly, const ConEmuHotKey* hk, CRealConsole* pRCon)
{
if (TestOnly)
return true;
// Должно обрабатываться через WM_HOTKEY
CVConGuard VCon;
if (gpConEmu->GetActiveVCon(&VCon) >= 0)
{
VCon->RCon()->ChildSystemMenu();
}
return true;
}
示例11: CanActivateTab
bool CTabBarClass::CanActivateTab(int nTabIdx)
{
CVConGuard VCon;
DWORD wndIndex = 0;
if (!GetVConFromTab(nTabIdx, &VCon, &wndIndex))
return false;
if (!VCon->RCon()->CanActivateFarWindow(wndIndex))
return false;
return true;
}
示例12: SendRClick
void CGestures::SendRClick(HWND hWnd, const LONG ldx, const LONG ldy)
{
CVConGuard VCon;
CRealConsole* pRCon = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon->RCon() : NULL;
if (pRCon)
{
POINT pt = {ldx, ldy};
if (hWnd != VCon->GetView())
MapWindowPoints(hWnd, VCon->GetView(), &pt, 1);
pRCon->OnMouse(WM_RBUTTONDOWN, MK_RBUTTON, pt.x, pt.y);
pRCon->OnMouse(WM_RBUTTONUP, 0, pt.x, pt.y);
}
}
示例13: OnPostLocalize
void CSetPgInfo::OnPostLocalize(HWND hDlg)
{
CVirtualConsole* pVCon = NULL;
CVConGuard VCon;
if (CVConGroup::GetActiveVCon(&VCon) >= 0)
pVCon = VCon.VCon();
// Performance
gpSetCls->Performance(gbPerformance, TRUE);
if (pVCon)
{
FillConsoleMode(hDlg, pVCon->RCon());
}
}
示例14: GetOpenedPanels
size_t CConEmuCtrl::GetOpenedPanels(wchar_t*& pszDirs, int& iCount, int& iCurrent)
{
CmdArg szActiveDir, szPassive;
CVConGuard VCon;
MArray<wchar_t*> Dirs;
size_t cchAllLen = 1;
iCount = iCurrent = 0;
for (int V = 0; CVConGroup::GetVCon(V, &VCon, true); V++)
{
VCon->RCon()->GetPanelDirs(szActiveDir, szPassive);
if (VCon->isActive(false))
iCurrent = iCount;
LPCWSTR psz[] = {szActiveDir.ms_Arg, szPassive.ms_Arg};
for (int i = 0; i <= 1; i++)
{
if (psz[i] && psz[i][0])
{
int iLen = lstrlen(psz[i]);
cchAllLen += (iLen+1);
Dirs.push_back(lstrdup(psz[i]));
iCount++;
}
}
}
_ASSERTE(pszDirs == NULL);
pszDirs = (wchar_t*)malloc(cchAllLen*sizeof(*pszDirs));
if (!pszDirs)
return 0;
wchar_t* psz = pszDirs;
for (int i = 0; i < Dirs.size(); i++)
{
wchar_t* p = Dirs[i];
_wcscpy_c(psz, cchAllLen, p);
psz += lstrlen(psz)+1;
free(p);
}
return cchAllLen;
}
示例15: if
INT_PTR CSetDlgColors::ColorCtlStatic(HWND hWnd2, WORD c, HWND hItem)
{
if (GetDlgItem(hWnd2, c) == hItem)
{
if (mh_CtlColorBrush) DeleteObject(mh_CtlColorBrush);
COLORREF cr = 0;
if (c >= c32 && c <= c34)
{
ThumbColor *ptc = NULL;
if (c == c32) ptc = &gpSet->ThSet.crBackground;
else if (c == c33) ptc = &gpSet->ThSet.crPreviewFrame;
else ptc = &gpSet->ThSet.crSelectFrame;
//
if (ptc->UseIndex)
{
if (ptc->ColorIdx >= 0 && ptc->ColorIdx <= 15)
{
cr = gpSet->Colors[ptc->ColorIdx];
}
else
{
CVConGuard VCon;
const CEFAR_INFO_MAPPING *pfi = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon->RCon()->GetFarInfo() : NULL;
if (pfi && pfi->cbSize>=sizeof(CEFAR_INFO_MAPPING))
{
cr = gpSet->Colors[(pfi->nFarColors[col_PanelText] & 0xF0)>>4];
}
else
{
cr = gpSet->Colors[1];
}
}
}