本文整理汇总了C++中CVirtualConsole类的典型用法代码示例。如果您正苦于以下问题:C++ CVirtualConsole类的具体用法?C++ CVirtualConsole怎么用?C++ CVirtualConsole使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CVirtualConsole类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
CVirtualConsole* pVCon = gpConEmu->GetVCon(nNewV);
if (pVCon)
{
CRealConsole* pRCon = pVCon->RCon();
if (pRCon)
{
pRCon->ActivateFarWindow(nNewR);
}
if (!gpConEmu->isActive(pVCon))
gpConEmu->Activate(pVCon);
}
}
DestroyMenu(hPopup);
}
示例2: Attach
bool CVConGuard::Attach(CVirtualConsole* apRef)
{
if (mp_Ref != apRef)
{
CVirtualConsole *pOldRef = mp_Ref;
mp_Ref = apRef;
if (pOldRef != mp_Ref)
{
if (mp_Ref)
{
mp_Ref->AddRef();
}
if (pOldRef)
{
pOldRef->Release();
}
}
}
mi_Valid = mp_Ref ? CVConGroup::isValid(mp_Ref) ? 1 : -1 : 0;
Assert(mi_Valid >= 0);
return (mp_Ref != NULL);
}
示例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: GetWindowThreadProcessId
BOOL CConEmuChild::ShowView(int nShowCmd)
{
if (!this || !mh_WndDC)
return FALSE;
BOOL bRc = FALSE;
DWORD nTID = 0, nPID = 0;
wchar_t sInfo[200];
// Должно быть создано в главной нити!
nTID = GetWindowThreadProcessId(mh_WndDC, &nPID);
#ifdef _DEBUG
DWORD nMainThreadID = GetWindowThreadProcessId(ghWnd, &nPID);
_ASSERTE(nTID==nMainThreadID);
#endif
// Если это "GUI" режим - могут возникать блокировки из-за дочернего окна
CVirtualConsole* pVCon = (CVirtualConsole*)this;
_ASSERTE(pVCon!=NULL);
CVConGuard guard(pVCon);
HWND hChildGUI = pVCon->GuiWnd();
BOOL bGuiVisible = (hChildGUI && nShowCmd) ? pVCon->RCon()->isGuiVisible() : FALSE;
if (gpSetCls->isAdvLogging)
{
if (hChildGUI != NULL)
_wsprintf(sInfo, SKIPLEN(countof(sInfo)) L"ShowView: Back=x%08X, DC=x%08X, ChildGUI=x%08X, ShowCMD=%u, ChildVisible=%u",
(DWORD)mh_WndBack, (DWORD)mh_WndDC, (DWORD)hChildGUI, nShowCmd, bGuiVisible);
else
_wsprintf(sInfo, SKIPLEN(countof(sInfo)) L"ShowView: Back=x%08X, DC=x%08X, ShowCMD=%u",
(DWORD)mh_WndBack, (DWORD)mh_WndDC, nShowCmd);
gpConEmu->LogString(sInfo);
}
if ((GetCurrentThreadId() != nTID) || (hChildGUI != NULL))
{
bRc = ShowWindowAsync(mh_WndBack, nShowCmd);
bRc = ShowWindowAsync(mh_WndDC, bGuiVisible ? SW_HIDE : nShowCmd);
}
else
{
bRc = ShowWindow(mh_WndBack, nShowCmd);
bRc = ShowWindow(mh_WndDC, nShowCmd);
if (nShowCmd)
{
SetWindowPos(mh_WndDC, HWND_TOP, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
SetWindowPos(mh_WndBack, mh_WndDC, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
}
}
return bRc;
}
示例5: 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());
}
}
示例6: PostOnVConClosed
void CConEmuChild::PostOnVConClosed()
{
// Must be called FOR VALID objects ONLY (guared from outside)!
CVirtualConsole* pVCon = (CVirtualConsole*)this;
if (CVConGroup::isValid(pVCon)
&& !InterlockedExchange(&this->mn_MsgVConTerminated, gn_MsgVConTerminated))
{
ShutdownGuiStep(L"ProcessVConClosed - repost");
PostMessage(this->mh_WndDC, gn_MsgVConTerminated, 0, (LPARAM)pVCon);
}
#ifdef _DEBUG
// Must be guarded and thats why valid...
int iRef = pVCon->RefCount();
_ASSERTE(CVConGroup::isValid(pVCon) || (iRef>=1 && iRef<10));
#endif
}
示例7: OnInitDialog
LRESULT CSetPgInfo::OnInitDialog(HWND hDlg, bool abInitial)
{
CVirtualConsole* pVCon = NULL;
CVConGuard VCon;
if (CVConGroup::GetActiveVCon(&VCon) >= 0)
pVCon = VCon.VCon();
SetDlgItemText(hDlg, tCurCmdLine, GetCommandLine());
gpConEmu->UpdateProcessDisplay(TRUE);
gpConEmu->UpdateSizes();
if (pVCon)
{
ConsoleInfoArg cursorInfo = {};
pVCon->RCon()->GetConsoleInfo(&cursorInfo);
FillCursorInfo(hDlg, &cursorInfo);
}
FillFontInfo(hDlg);
return 0;
}
示例8: UM_USER_CONTROLS
//.........这里部分代码省略.........
ShowWindow(GetDlgItem(hDlg, rbRecreateSplit2Bottom), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, stRecreateSplit), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, tRecreateSplit), SW_HIDE);
}
else
{
// Fill splits
SetDlgItemInt(hDlg, tRecreateSplit, (1000-pArgs->nSplitValue)/10, FALSE);
CheckRadioButton(hDlg, rbRecreateSplitNone, rbRecreateSplit2Bottom, rbRecreateSplitNone+pArgs->eSplit);
EnableWindow(GetDlgItem(hDlg, tRecreateSplit), (pArgs->eSplit != pArgs->eSplitNone));
EnableWindow(GetDlgItem(hDlg, stRecreateSplit), (pArgs->eSplit != pArgs->eSplitNone));
}
// Спрятать флажок "New window"
bool bRunInNewWindow_Hidden = (pArgs->aRecreate == cra_EditTab || pArgs->aRecreate == cra_RecreateTab);
ShowWindow(GetDlgItem(hDlg, cbRunInNewWindow), bRunInNewWindow_Hidden ? SW_HIDE : SW_SHOWNORMAL);
const wchar_t *pszUser = pArgs->pszUserName;
const wchar_t *pszDomain = pArgs->pszDomain;
bool bResticted = (pArgs->RunAsRestricted == crb_On);
int nChecked = rbCurrentUser;
DWORD nUserNameLen = countof(pDlg->ms_CurUser);
if (!GetUserName(pDlg->ms_CurUser, &nUserNameLen)) pDlg->ms_CurUser[0] = 0;
wchar_t szRbCaption[MAX_PATH*3];
lstrcpy(szRbCaption, L"Run as current &user: "); lstrcat(szRbCaption, pDlg->ms_CurUser);
SetDlgItemText(hDlg, rbCurrentUser, szRbCaption);
wchar_t szOtherUser[MAX_PATH*2+1]; szOtherUser[0] = 0;
CVConGuard VCon;
CVirtualConsole* pVCon = (gpConEmu->GetActiveVCon(&VCon) >= 0) ? VCon.VCon() : NULL;
if ((pArgs->pszUserName && *pArgs->pszUserName)
|| ((pArgs->aRecreate == cra_RecreateTab) && pVCon && pVCon->RCon()->GetUserPwd(&pszUser, &pszDomain, &bResticted)))
{
nChecked = rbAnotherUser;
if (bResticted)
{
CheckDlgButton(hDlg, cbRunAsRestricted, BST_CHECKED);
}
else
{
if (pArgs->pszUserName && *pArgs->pszUserName)
lstrcpyn(szOtherUser, pArgs->pszUserName, countof(szOtherUser));
else
lstrcpyn(szOtherUser, pDlg->ms_CurUser, countof(szOtherUser));
if (pszDomain)
{
if (wcschr(pszDomain, L'.'))
{
// Если в имени домена есть точка - используем нотацию [email protected]
// По идее, мы сюда не попадаем, т.к. при вводе имени в таком формате
// pszDomain не заполняется, и "UPN format" остается в pszUser
lstrcpyn(szOtherUser, pszUser, MAX_PATH);
wcscat_c(szOtherUser, L"@");
lstrcpyn(szOtherUser+_tcslen(szOtherUser), pszDomain, MAX_PATH);
}
else
{
// "Старая" нотация domain\user
lstrcpyn(szOtherUser, pszDomain, MAX_PATH);
示例9: _ASSERTE
size_t CConEmuCtrl::GetOpenedTabs(CESERVER_REQ_GETALLTABS::TabInfo*& pTabs)
{
_ASSERTE(pTabs==NULL);
int nConCount = gpConEmu->GetConCount();
int nActiveCon = gpConEmu->ActiveConNum();
size_t cchMax = nConCount*16;
size_t cchCount = 0;
CVirtualConsole* pVCon;
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 szMark[6];
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(szMark, tab.Modified ? L" * " : L" ");
switch ((tab.Type & fwt_TypeMask))
{
case fwt_Editor:
wcscpy_c(szMark, tab.Modified ? L" * " : L" E "); break;
case fwt_Viewer:
wcscpy_c(szMark, L" V "); break;
default:
wcscpy_c(szMark, L" ");
}
if (V == nActiveCon)
{
if (T <= 9)
_wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/&%i]%s", V+1, T, szMark);
//else if (T == 9)
// _wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/1&0]%s", V+1, szMark);
else
_wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/%i]%s", V+1, T, szMark);
}
else
{
_wsprintf(pTabs[cchCount].Title, SKIPLEN(countof(pTabs[cchCount].Title)) L"[%i/%i]%s", V+1, T, szMark);
}
int nCurLen = lstrlen(pTabs[cchCount].Title);
lstrcpyn(pTabs[cchCount].Title+nCurLen, tab.Name, countof(pTabs[cchCount].Title)-nCurLen);
cchCount++;
}
}
return cchCount;
}
示例10: if
LRESULT CConEmuChild::ChildWndProc(HWND hWnd, UINT messg, WPARAM wParam, LPARAM lParam)
{
LRESULT result = 0;
// Logger
MSG msgStr = {hWnd, messg, wParam, lParam};
ConEmuMsgLogger::Log(msgStr, ConEmuMsgLogger::msgCanvas);
if (gpSetCls->isAdvLogging >= 4)
{
gpConEmu->LogMessage(hWnd, messg, wParam, lParam);
}
CVConGuard guard;
CVirtualConsole* pVCon = NULL;
if (messg == WM_CREATE || messg == WM_NCCREATE)
{
LPCREATESTRUCT lp = (LPCREATESTRUCT)lParam;
guard = (CVirtualConsole*)lp->lpCreateParams;
pVCon = guard.VCon();
if (pVCon)
{
gVConDcMap.Set(hWnd, pVCon);
pVCon->m_TAutoCopy.Init(hWnd, TIMER_AUTOCOPY, TIMER_AUTOCOPY_DELAY);
pVCon->m_TScrollShow.Init(hWnd, TIMER_SCROLL_SHOW, TIMER_SCROLL_SHOW_DELAY);
pVCon->m_TScrollHide.Init(hWnd, TIMER_SCROLL_HIDE, TIMER_SCROLL_HIDE_DELAY);
#ifndef SKIP_HIDE_TIMER
pVCon->m_TScrollCheck.Init(hWnd, TIMER_SCROLL_CHECK, TIMER_SCROLL_CHECK_DELAY);
#endif
}
}
else if (hWnd != ghDcInDestroing)
{
if (!gVConDcMap.Get(hWnd, &pVCon) || !guard.Attach(pVCon))
pVCon = NULL;
}
if (messg == WM_SYSCHAR)
{
_ASSERTE(FALSE); // по идее, фокуса тут быть не должно
// Чтобы не пищало
result = TRUE;
goto wrap;
}
if (!pVCon)
{
_ASSERTE(pVCon!=NULL || hWnd==ghDcInDestroing);
result = DefWindowProc(hWnd, messg, wParam, lParam);
goto wrap;
}
switch (messg)
{
case WM_SHOWWINDOW:
{
#ifdef _DEBUG
HWND hGui = pVCon->GuiWnd();
if (hGui)
{
_ASSERTE(((wParam==0) || pVCon->RCon()->isGuiForceConView()) && "Show DC while GuiWnd exists");
}
#endif
result = DefWindowProc(hWnd, messg, wParam, lParam);
break;
}
case WM_SETFOCUS:
// Если в консоли работает "GUI" окно (GUI режим), то фокус нужно отдать туда.
{
// Фокус должен быть в главном окне! За исключением случая работы в GUI режиме.
pVCon->setFocus();
}
return 0;
case WM_ERASEBKGND:
result = 0;
break;
case WM_PAINT:
result = pVCon->OnPaint();
break;
case WM_PRINTCLIENT:
if (wParam && (lParam & PRF_CLIENT))
{
pVCon->PrintClient((HDC)wParam, false, NULL);
}
break;
case WM_SIZE:
#ifdef _DEBUG
{
RECT rc; GetClientRect(hWnd, &rc);
short cx = LOWORD(lParam);
rc.left = rc.left;
}
#endif
result = pVCon->OnSize(wParam, lParam);
break;
case WM_MOVE:
result = pVCon->OnMove(wParam, lParam);
//.........这里部分代码省略.........
示例11: _ASSERTE
//.........这里部分代码省略.........
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);
示例12: GetWindowThreadProcessId
BOOL CConEmuChild::ShowView(int nShowCmd)
{
if (!this || !mh_WndDC)
return FALSE;
BOOL bRc = FALSE;
DWORD nTID = 0, nPID = 0;
wchar_t sInfo[200];
// Должно быть создано в главной нити!
nTID = GetWindowThreadProcessId(mh_WndDC, &nPID);
#ifdef _DEBUG
DWORD nMainThreadID = GetWindowThreadProcessId(ghWnd, &nPID);
_ASSERTE(nTID==nMainThreadID);
#endif
// Если это "GUI" режим - могут возникать блокировки из-за дочернего окна
CVirtualConsole* pVCon = mp_VCon;
_ASSERTE(pVCon!=NULL);
CVConGuard guard(pVCon);
HWND hChildGUI = pVCon->GuiWnd();
BOOL bGuiVisible = (hChildGUI && nShowCmd) ? pVCon->RCon()->isGuiVisible() : FALSE;
DWORD nDcShowCmd = nShowCmd;
if (gpSetCls->isAdvLogging)
{
if (hChildGUI != NULL)
_wsprintf(sInfo, SKIPLEN(countof(sInfo)) L"ShowView: Back=x%08X, DC=x%08X, ChildGUI=x%08X, ShowCMD=%u, ChildVisible=%u",
(DWORD)mh_WndBack, (DWORD)mh_WndDC, (DWORD)hChildGUI, nShowCmd, bGuiVisible);
else
_wsprintf(sInfo, SKIPLEN(countof(sInfo)) L"ShowView: Back=x%08X, DC=x%08X, ShowCMD=%u",
(DWORD)mh_WndBack, (DWORD)mh_WndDC, nShowCmd);
gpConEmu->LogString(sInfo);
}
if (hChildGUI || (GetCurrentThreadId() != nTID))
{
// Только Async, иначе можно получить dead-lock
bRc = ShowWindowAsync(mh_WndBack, nShowCmd);
if (bGuiVisible && !mp_VCon->RCon()->isGuiForceConView())
nDcShowCmd = SW_HIDE;
bRc = ShowWindowAsync(mh_WndDC, nDcShowCmd);
}
else
{
bRc = ShowWindow(mh_WndBack, nShowCmd);
bRc = ShowWindow(mh_WndDC, nShowCmd);
if (nShowCmd)
{
SetWindowPos(mh_WndDC, HWND_TOP, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
SetWindowPos(mh_WndBack, mh_WndDC, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
}
}
if (nShowCmd && bGuiVisible)
{
// Если активируется таб с ChildGui
if (pVCon->isActive(false))
{
PostRestoreChildFocus();
}
}
return bRc;
}
示例13: OnNotify
bool CTabBarClass::OnNotify(LPNMHDR nmhdr, LRESULT& lResult)
{
if (!this)
return false;
if (!_active)
return false;
lResult = 0;
if (mp_Rebar->OnNotifyInt(nmhdr, lResult))
return true;
if (nmhdr->code == TBN_GETINFOTIP && mp_Rebar->IsToolbarNotify(nmhdr))
{
if (!gpSet->isMultiShowButtons)
return false;
LPNMTBGETINFOTIP pDisp = (LPNMTBGETINFOTIP)nmhdr;
//if (pDisp->iItem>=1 && pDisp->iItem<=MAX_CONSOLE_COUNT)
if (pDisp->iItem == TID_ACTIVE_NUMBER)
{
if (!pDisp->pszText || !pDisp->cchTextMax)
return true;
CVConGuard VCon;
CVirtualConsole* pVCon = (gpConEmu->GetActiveVCon(&VCon) >= 0) ? VCon.VCon() : NULL;
LPCWSTR pszTitle = pVCon ? pVCon->RCon()->GetTitle() : NULL;
if (pszTitle)
{
lstrcpyn(pDisp->pszText, pszTitle, pDisp->cchTextMax);
}
else
{
pDisp->pszText[0] = 0;
}
}
else if (pDisp->iItem == TID_CREATE_CON)
{
lstrcpyn(pDisp->pszText, _T("Create new console"), pDisp->cchTextMax);
}
else if (pDisp->iItem == TID_ALTERNATIVE)
{
bool lbChecked = mp_Rebar->GetToolBtnChecked(TID_ALTERNATIVE);
lstrcpyn(pDisp->pszText,
lbChecked ? L"Alternative mode is ON (console freezed)" : L"Alternative mode is off",
pDisp->cchTextMax);
}
else if (pDisp->iItem == TID_SCROLL)
{
bool lbChecked = mp_Rebar->GetToolBtnChecked(TID_SCROLL);
lstrcpyn(pDisp->pszText,
lbChecked ? L"BufferHeight mode is ON (scrolling enabled)" : L"BufferHeight mode is off",
pDisp->cchTextMax);
}
else if (pDisp->iItem == TID_MINIMIZE)
{
lstrcpyn(pDisp->pszText, _T("Minimize window"), pDisp->cchTextMax);
}
else if (pDisp->iItem == TID_MAXIMIZE)
{
lstrcpyn(pDisp->pszText, _T("Maximize window"), pDisp->cchTextMax);
}
else if (pDisp->iItem == TID_APPCLOSE)
{
lstrcpyn(pDisp->pszText, _T("Close ALL consoles"), pDisp->cchTextMax);
}
//else if (pDisp->iItem == TID_COPYING)
//{
// lstrcpyn(pDisp->pszText, _T("Show copying queue"), pDisp->cchTextMax);
//}
else if (pDisp->iItem == TID_SYSMENU)
{
lstrcpyn(pDisp->pszText, _T("Show system menu (RClick for Settings)"), pDisp->cchTextMax);
}
else
{
_ASSERTE(FALSE && "Tooltip was not processed");
}
return true;
}
if (nmhdr->code == TBN_DROPDOWN && mp_Rebar->IsToolbarNotify(nmhdr))
{
LPNMTOOLBAR pBtn = (LPNMTOOLBAR)nmhdr;
switch (pBtn->iItem)
{
case TID_ACTIVE_NUMBER:
OnChooseTabPopup();
break;
case TID_CREATE_CON:
gpConEmu->mp_Menu->OnNewConPopupMenu(NULL, 0, isPressed(VK_SHIFT));
break;
#ifdef _DEBUG
default:
_ASSERTE(FALSE && "DropDown was not processed");
//.........这里部分代码省略.........
示例14: _ASSERTE
void CTabBarClass::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (!this)
return;
if (!mp_Rebar->IsToolbarCommand(wParam, lParam))
return;
if (!gpSet->isMultiShowButtons)
{
_ASSERTE(gpSet->isMultiShowButtons);
return;
}
if (wParam == TID_ACTIVE_NUMBER)
{
//gpConEmu->ConActivate(wParam-1);
OnChooseTabPopup();
}
else if (wParam == TID_CREATE_CON)
{
if (gpConEmu->IsGesturesEnabled())
gpConEmu->mp_Menu->OnNewConPopupMenu(NULL, 0, isPressed(VK_SHIFT));
else
gpConEmu->RecreateAction(gpSetCls->GetDefaultCreateAction(), gpSet->isMultiNewConfirm || isPressed(VK_SHIFT));
}
else if (wParam == TID_ALTERNATIVE)
{
CVConGuard VCon;
CVirtualConsole* pVCon = (gpConEmu->GetActiveVCon(&VCon) >= 0) ? VCon.VCon() : NULL;
// Вернуть на тулбар _текущее_ состояние режима
mp_Rebar->SetToolBtnChecked(TID_ALTERNATIVE, pVCon ? pVCon->RCon()->isAlternative() : false);
// И собственно Action
gpConEmu->AskChangeAlternative();
}
else if (wParam == TID_SCROLL)
{
CVConGuard VCon;
CVirtualConsole* pVCon = (gpConEmu->GetActiveVCon(&VCon) >= 0) ? VCon.VCon() : NULL;
// Вернуть на тулбар _текущее_ состояние режима
mp_Rebar->SetToolBtnChecked(TID_SCROLL, pVCon ? pVCon->RCon()->isBufferHeight() : false);
// И собственно Action
gpConEmu->AskChangeBufferHeight();
}
else if (wParam == TID_MINIMIZE)
{
PostMessage(ghWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
}
else if (wParam == TID_MAXIMIZE)
{
// Чтобы клик случайно не провалился в консоль
gpConEmu->mouse.state |= MOUSE_SIZING_DBLCKL;
// Аналог AltF9
gpConEmu->DoMaximizeRestore();
}
else if (wParam == TID_APPCLOSE)
{
gpConEmu->PostScClose();
}
//else if (wParam == TID_COPYING)
//{
// gpConEmu->OnCopyingState();
//}
else if (wParam == TID_SYSMENU)
{
RECT rcBtnRect = {0};
mp_Rebar->GetToolBtnRect(TID_SYSMENU, &rcBtnRect);
DWORD nAddFlags = ((gpSet->nTabsLocation == 1) ? TPM_BOTTOMALIGN : 0) | TPM_RIGHTALIGN;
LogString(L"ShowSysmenu called from (ToolBar)");
gpConEmu->mp_Menu->ShowSysmenu(rcBtnRect.right,rcBtnRect.bottom, nAddFlags);
}
else
{
_ASSERTE(FALSE && "Toolbar click was not processed");
}
}
示例15: BackWndProc
LRESULT CConEmuChild::BackWndProc(HWND hWnd, UINT messg, WPARAM wParam, LPARAM lParam)
{
LRESULT result = 0;
// Logger
MSG msgStr = {hWnd, messg, wParam, lParam};
ConEmuMsgLogger::Log(msgStr, ConEmuMsgLogger::msgBack);
if (gpSetCls->isAdvLogging >= 4)
{
gpConEmu->LogMessage(hWnd, messg, wParam, lParam);
}
CVConGuard guard;
CVirtualConsole* pVCon = NULL;
if (messg == WM_CREATE || messg == WM_NCCREATE)
{
LPCREATESTRUCT lp = (LPCREATESTRUCT)lParam;
guard = (CVirtualConsole*)lp->lpCreateParams;
pVCon = guard.VCon();
if (pVCon)
gVConBkMap.Set(hWnd, pVCon);
}
else if (hWnd != ghBkInDestroing)
{
if (!gVConBkMap.Get(hWnd, &pVCon) || !guard.Attach(pVCon))
pVCon = NULL;
}
if (messg == WM_SYSCHAR)
{
_ASSERTE(FALSE); // по идее, фокуса тут быть не должно
// Чтобы не пищало
result = TRUE;
goto wrap;
}
if (!pVCon)
{
_ASSERTE(pVCon!=NULL || hWnd==ghBkInDestroing);
result = DefWindowProc(hWnd, messg, wParam, lParam);
goto wrap;
}
switch (messg)
{
case WM_SHOWWINDOW:
if (wParam)
{
HWND hView = pVCon->GetView();
SetWindowPos(hView, HWND_TOP, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
SetWindowPos(hWnd, hView, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
}
break; // DefaultProc
case WM_SETFOCUS:
// Если в консоли работает "GUI" окно (GUI режим), то фокус нужно отдать туда.
{
// Фокус должен быть в главном окне! За исключением случая работы в GUI режиме.
pVCon->setFocus();
}
return 0;
case WM_ERASEBKGND:
result = 0;
break;
case WM_PAINT:
_ASSERTE(hWnd == pVCon->mh_WndBack);
pVCon->OnPaintGaps();
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_MOUSEWHEEL:
case WM_ACTIVATE:
case WM_ACTIVATEAPP:
//case WM_MOUSEACTIVATE:
case WM_KILLFOCUS:
//case WM_SETFOCUS:
case WM_MOUSEMOVE:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_XBUTTONDOWN:
case WM_XBUTTONUP:
case WM_XBUTTONDBLCLK:
case WM_VSCROLL:
// Вся обработка в родителе
{
switch (messg)
{
case WM_VSCROLL:
switch (LOWORD(wParam))
{
case SB_THUMBTRACK:
//.........这里部分代码省略.........