本文整理汇总了C++中CVirtualConsole::RCon方法的典型用法代码示例。如果您正苦于以下问题:C++ CVirtualConsole::RCon方法的具体用法?C++ CVirtualConsole::RCon怎么用?C++ CVirtualConsole::RCon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVirtualConsole
的用法示例。
在下文中一共展示了CVirtualConsole::RCon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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;
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);
}
示例3: ShowView
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;
}
示例4: 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());
}
}
示例5: 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;
}
示例6: OnCommand
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");
}
}
示例7: 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");
//.........这里部分代码省略.........
示例8: RecreateDlgProc
INT_PTR CRecreateDlg::RecreateDlgProc(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam)
{
#define UM_USER_CONTROLS (WM_USER+121)
#define UM_FILL_CMDLIST (WM_USER+122)
CRecreateDlg* pDlg = NULL;
if (messg == WM_INITDIALOG)
{
pDlg = (CRecreateDlg*)lParam;
pDlg->mh_Dlg = hDlg;
SetWindowLongPtr(hDlg, DWLP_USER, lParam);
}
else
{
pDlg = (CRecreateDlg*)GetWindowLongPtr(hDlg, DWLP_USER);
}
if (!pDlg)
{
return FALSE;
}
PatchMsgBoxIcon(hDlg, messg, wParam, lParam);
switch (messg)
{
case WM_INITDIALOG:
{
LRESULT lbRc = FALSE;
// Visual
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hClassIcon);
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hClassIconSm);
// Set password style (avoid "bars" on some OS)
SendDlgItemMessage(hDlg, tRunAsPassword, WM_SETFONT, (LPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT), 0);
// Add menu items
HMENU hSysMenu = GetSystemMenu(hDlg, FALSE);
InsertMenu(hSysMenu, 0, MF_BYPOSITION, MF_SEPARATOR, 0);
InsertMenu(hSysMenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED,
ID_RESETCMDHISTORY, L"Clear history...");
InsertMenu(hSysMenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED
| (gpSet->isSaveCmdHistory ? MF_CHECKED : 0),
ID_STORECMDHISTORY, L"Store history");
//#ifdef _DEBUG
//SetWindowPos(ghOpWnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
//#endif
RConStartArgs* pArgs = pDlg->mp_Args;
_ASSERTE(pArgs);
// Fill command and task drop down
SendMessage(hDlg, UM_FILL_CMDLIST, TRUE, 0);
// Set text in command and folder fields
SetDlgItemText(hDlg, IDC_RESTART_CMD, pDlg->mpsz_DefCmd ? pDlg->mpsz_DefCmd : pArgs->pszSpecialCmd ? pArgs->pszSpecialCmd : L"");
SetDlgItemText(hDlg, IDC_STARTUP_DIR, pDlg->mpsz_DefDir ? pDlg->mpsz_DefDir : pArgs->pszStartupDir ? pArgs->pszStartupDir : gpConEmu->WorkDir());
// Split controls
if (pArgs->aRecreate == cra_RecreateTab)
{
// Hide Split's
ShowWindow(GetDlgItem(hDlg, gbRecreateSplit), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, rbRecreateSplitNone), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, rbRecreateSplit2Right), SW_HIDE);
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);
//.........这里部分代码省略.........
示例9: GetOpenedTabs
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: BackWndProc
//.........这里部分代码省略.........
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:
case SB_THUMBPOSITION:
pVCon->mb_VTracking = TRUE;
break;
case SB_ENDSCROLL:
pVCon->mb_VTracking = FALSE;
break;
}
pVCon->RCon()->OnSetScrollPos(wParam);
break;
case WM_LBUTTONUP:
pVCon->mb_VTracking = FALSE;
break;
}
TODO("Обработка ghWndWork");
HWND hParent = ghWnd;
_ASSERTE(GetParent(hWnd)==ghWnd);
if (messg >= WM_MOUSEFIRST && messg <= WM_MOUSELAST)
{
POINT pt = {LOWORD(lParam),HIWORD(lParam)};
MapWindowPoints(hWnd, hParent, &pt, 1);
lParam = MAKELONG(pt.x,pt.y);
}
result = gpConEmu->WndProc(hParent, messg, wParam, lParam);
}
break;
case WM_IME_NOTIFY:
break;
case WM_INPUTLANGCHANGE:
case WM_INPUTLANGCHANGEREQUEST:
{
#ifdef _DEBUG
if (IsDebuggerPresent())
{
WCHAR szMsg[128];
_wsprintf(szMsg, SKIPLEN(countof(szMsg)) L"InChild %s(CP:%i, HKL:0x%08X)\n",
(messg == WM_INPUTLANGCHANGE) ? L"WM_INPUTLANGCHANGE" : L"WM_INPUTLANGCHANGEREQUEST",
示例11: ChildWndProc
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);
//.........这里部分代码省略.........
示例12: GuiServerCommand
//// Эта функция пайп не закрывает!
//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);
}
//.........这里部分代码省略.........
示例13: ShowView
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;
}
示例14: Update
//.........这里部分代码省略.........
if (CVConGroup::isGroup(pVCon, &pGr, &VGrActive))
{
CVirtualConsole* pGrVCon;
if (Groups.Get(pGr, &pGrVCon))
continue; // эта группа уже есть
pGrVCon = VGrActive.VCon();
Groups.Set(pGr, pGrVCon);
// И показывать таб нужно от "активной" консоли, а не от первой в группе
if (pVCon != pGrVCon)
{
guard = pGrVCon;
pVCon = pGrVCon;
}
if (!lbActive)
{
lbActive = pVCon->isActive(true);
}
// Показывать редакторы из всех групп?
if (gpSet->bShowFarWindows)
{
MArray<CVConGuard*> Panes;
int nPanes = pGr->GetGroupPanes(&Panes);
// Только если в группе более одного таба - тогда нужно дополниетльная логика населения...
if (nPanes > 1)
{
// Первым табом - показать текущую панель, либо МОДАЛЬНЫЙ редактор/вьювер
// Редакторы из "far /e ..." здесь НЕ добавлять!
if (!pVCon->RCon()->isFarPanelAllowed()
|| !UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged, pVCon, uat_PanelsOrModalsOnly))
{
// Если есть - добавить ОДНУ панель, чтобы табы сплита не прыгали туда-сюда
for (int K = 0; K < nPanes; K++)
{
if (Panes[K]->VCon()->RCon()->isFarPanelAllowed())
{
if (UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged,
Panes[K]->VCon(), uat_PanelsOnly) > 0)
break;
}
}
}
// Потом - все оставшиеся редакторы/вьюверы (в том числе и "far /e ...")
for (int K = 0; K < nPanes; K++)
{
UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged,
Panes[K]->VCon(), uat_NonModals|uat_NonPanels);
}
// Release
CVConGroup::FreePanesArray(Panes);
// Already processed, next VCon
continue;
}
}
}
}
UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged, pVCon, uat_AnyTab);
示例15: OnInitDialog
INT_PTR CRecreateDlg::OnInitDialog(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam)
{
LRESULT lbRc = FALSE;
gpConEmu->OnOurDialogOpened();
CDynDialog::LocalizeDialog(hDlg);
// Visual
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hClassIcon);
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hClassIconSm);
// Set password style (avoid "bars" on some OS)
SendDlgItemMessage(hDlg, tRunAsPassword, WM_SETFONT, (LPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT), 0);
// Add menu items
HMENU hSysMenu = GetSystemMenu(hDlg, FALSE);
InsertMenu(hSysMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
InsertMenu(hSysMenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED,
ID_RESETCMDHISTORY, L"Clear history...");
InsertMenu(hSysMenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED
| (gpSet->isSaveCmdHistory ? MF_CHECKED : 0),
ID_STORECMDHISTORY, L"Store history");
//#ifdef _DEBUG
//SetWindowPos(ghOpWnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
//#endif
RConStartArgsEx* pArgs = mp_Args;
_ASSERTE(pArgs);
// Fill command and task drop down
SendMessage(hDlg, UM_FILL_CMDLIST, TRUE, 0);
// Set text in command and folder fields
{
LPCWSTR pszSetCmd = mpsz_DefCmd ? mpsz_DefCmd : pArgs->pszSpecialCmd ? pArgs->pszSpecialCmd : L"";
CEStr lsTempCmd, lsAppend;
if (!mpsz_DefCmd && pArgs)
{
RConStartArgsEx tempArgs;
tempArgs.AssignFrom(pArgs);
tempArgs.CleanSecure();
tempArgs.RunAsSystem = pArgs->RunAsSystem;
tempArgs.eSplit = RConStartArgsEx::eSplitNone;
SafeFree(tempArgs.pszSpecialCmd);
SafeFree(tempArgs.pszStartupDir);
tempArgs.NewConsole = pArgs->NewConsole;
lsAppend = tempArgs.CreateCommandLine();
if (!lsAppend.IsEmpty())
{
lsTempCmd = lstrmerge(pszSetCmd, ((lsAppend[0] == L' ') ? NULL : L" "), lsAppend);
pszSetCmd = lsTempCmd.ms_Val;
}
}
SetDlgItemText(hDlg, IDC_RESTART_CMD, pszSetCmd);
// TODO: gh-959: enable autocorrection of cbRunAsAdmin by IDC_RESTART_CMD task contents (first line)
}
// "%CD%" was specified as startup dir? In Task parameters for example...
CEStr lsStartDir;
if (pArgs->pszStartupDir
&& (lstrcmpi(pArgs->pszStartupDir, L"%CD%") == 0))
{
lsStartDir.Set(ms_RConCurDir);
}
// Suggest default ConEmu working directory otherwise (unless it's a cra_RecreateTab)
if (lsStartDir.IsEmpty())
{
lsStartDir.Set(gpConEmu->WorkDir());
}
// Current directory, startup directory, ConEmu startup directory, and may be startup directory history in the future
AddDirectoryList(mpsz_DefDir ? mpsz_DefDir : lsStartDir.ms_Val);
AddDirectoryList(ms_RConCurDir);
AddDirectoryList(ms_RConStartDir);
AddDirectoryList(gpConEmu->WorkDir());
LPCWSTR pszShowDir;
if ((pArgs->aRecreate == cra_RecreateTab) && !ms_RConCurDir.IsEmpty())
pszShowDir = ms_RConCurDir;
else
pszShowDir = mpsz_DefDir ? mpsz_DefDir : lsStartDir.ms_Val;
SetDlgItemText(hDlg, IDC_STARTUP_DIR, pszShowDir);
// Split controls
if (pArgs->aRecreate == cra_RecreateTab)
{
// Hide Split's
ShowWindow(GetDlgItem(hDlg, gbRecreateSplit), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, rbRecreateSplitNone), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, rbRecreateSplit2Right), SW_HIDE);
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);
//.........这里部分代码省略.........