|
@@ -4,8 +4,9 @@
|
|
|
#include "fileutil.h"
|
|
|
#include "array.h"
|
|
|
#include "iniutil.h"
|
|
|
-#include "EventCode.h"
|
|
|
+#include "GUIConsole_UserCode.h"
|
|
|
#include "import_libSysInit.h"
|
|
|
+#include "EventCode.h"
|
|
|
|
|
|
#include "AccessAuthorization_client_g.h"
|
|
|
using namespace AccessAuthorization;
|
|
@@ -46,9 +47,6 @@ void CAboutDlg::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl)
|
|
|
GetDlgItem(IDC_EDIT2).SetWindowTextA(dtSysTime.ToTimeString());
|
|
|
}
|
|
|
|
|
|
-#include "MaintainWatcher_client_g.h"
|
|
|
-using namespace MaintainWatcher;
|
|
|
-
|
|
|
void CAboutDlg::OnOK2(UINT uNotifyCode, int nID, CWindow wndCtl)
|
|
|
{
|
|
|
GetDlgItem(IDC_EDIT3).SetWindowTextA("");
|
|
@@ -78,59 +76,6 @@ void CAboutDlg::OnOK2(UINT uNotifyCode, int nID, CWindow wndCtl)
|
|
|
(const char*)info.tmStart.ToTimeString(), (const char*)info.tmReboot.ToTimeString(), (const char*)info.InstallVersion.ToString(),
|
|
|
info.eTriggerReason, info.wSameReasonTime, info.eWay, info.wSameWayTime);
|
|
|
GetDlgItem(IDC_EDIT3).SetWindowTextA(str);
|
|
|
-
|
|
|
- //auto pEntity = m_pGUITask->GetEntity();
|
|
|
- MaintainCertificate_ClientBase *pClient = new MaintainCertificate_ClientBase(pEntity);
|
|
|
- auto rc = pClient->Connect();
|
|
|
- if (rc != Error_Succeed)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("connect to MaintainWatcher entity fail: %d", rc);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MaintainCertificate_GetUserInfo_Req req = {};
|
|
|
- MaintainCertificate_GetUserInfo_Ans ans = {};
|
|
|
- rc = pClient->GetUserInfo(req, ans, 10000);
|
|
|
- if (rc != Error_Succeed)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get userinfo fail from MaintainWatcher: %d", rc);
|
|
|
- pClient->SafeDelete();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // UserID=SP00000004;UserName=RVC0001;AuthorierID=SP00000001;AuthorizeTime=2014/8/13 18:46:29;RecommenderSAP=80274390;RecommenderOfficeID=274390;
|
|
|
- CSimpleStringA &str = ans.UserInfo;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get maintainer info: %s", (const char*)str);
|
|
|
-
|
|
|
- CSimpleStringA m_strUserID, m_strUserName, m_strAuthorizer, m_strAuthTime;
|
|
|
- auto arr = str.Split(';');
|
|
|
- for (int i = 0; i < arr.GetCount(); i++)
|
|
|
- {
|
|
|
- auto arr2 = arr[i].Split('=');
|
|
|
- if (arr2.GetCount() != 2)
|
|
|
- continue;
|
|
|
-
|
|
|
- if (arr2[0] == "UserID")
|
|
|
- m_strUserID = arr2[1];
|
|
|
- else if (arr2[0] == "UserName")
|
|
|
- m_strUserName = arr2[1];
|
|
|
- else if (arr2[0] == "AuthorierID")
|
|
|
- m_strAuthorizer = arr2[1];
|
|
|
- else if (arr2[0] == "AuthorizeTime")
|
|
|
- m_strAuthTime = arr2[1];
|
|
|
- }
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UserID=%s;UserName=%s;Authorizer=%s;AuthTime=%s",
|
|
|
- (const char*)m_strUserID,
|
|
|
- (const char*)m_strUserName,
|
|
|
- (const char*)m_strAuthorizer,
|
|
|
- (const char*)m_strAuthTime);
|
|
|
-
|
|
|
- pClient->GetFunction()->CloseSession();
|
|
|
- }
|
|
|
-
|
|
|
- pClient = NULL;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
void CAboutDlg::OnOK3(UINT uNotifyCode, int nID, CWindow wndCtl)
|
|
@@ -1332,10 +1277,21 @@ void CSysInitView::CleanListView()
|
|
|
|
|
|
void CSysInitView::CheckSystemInit()
|
|
|
{
|
|
|
+ auto pFunc = m_pGUITask->GetEntity()->GetFunction();
|
|
|
+ CSmartPointer<IConfigInfo> spConfig;
|
|
|
+ auto rc = pFunc->OpenConfig(Config_CenterSetting, spConfig);
|
|
|
+ if (rc != Error_Succeed)
|
|
|
+ return;
|
|
|
+
|
|
|
int checkSysInit = 0;
|
|
|
- if (1 == checkSysInit) {
|
|
|
- CloseHandle((HANDLE)_beginthreadex(NULL, 0, (unsigned int(__stdcall*)(void*))SysInitCheck, this, 0, NULL));
|
|
|
- }
|
|
|
+ rc = spConfig->ReadConfigValueInt(m_pGUITask->GetEntity()->GetEntityName(), "CheckSysInit", checkSysInit);
|
|
|
+ if (rc != Error_Succeed)
|
|
|
+ return;
|
|
|
+
|
|
|
+ CSystemStaticInfo stStaticinfo;
|
|
|
+ pFunc->GetSystemStaticInfo(stStaticinfo);
|
|
|
+ if (1 == checkSysInit)
|
|
|
+ CloseHandle((HANDLE)_beginthreadex(NULL, 0, (unsigned int(__stdcall *)(void *))SysInitCheck, this, 0, NULL));
|
|
|
}
|
|
|
|
|
|
void CSysInitView::modifyCheckStatus(DWORD status)
|
|
@@ -1489,8 +1445,7 @@ BOOL CSysInitView::CheckThreadRunning()
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-void CSysInitView::TestHighLevelDbg(
|
|
|
- BOOL isShow, BOOL isHighLevel)
|
|
|
+void CSysInitView::TestHighLevelDbg(BOOL isShow, BOOL isHighLevel)
|
|
|
{
|
|
|
::PostMessage(this->GetParent(), WM_SHOW_MAINTAIN_VIEW, isShow ? 1 : 0, isHighLevel ? 1 : 0);
|
|
|
}
|
|
@@ -1687,7 +1642,7 @@ DWORD SysRestoreBegin(LPVOID lpv)
|
|
|
showMsg.Format(_T("取消系统定制功能初始化"));
|
|
|
if (1 == initDlg->m_systemMainRestoreCheck.GetCheck())
|
|
|
{
|
|
|
- if (!RVCInit_InitRestore())
|
|
|
+ if (!RVCInit_InitRestore(true))
|
|
|
initDlg->EasyAddMsgToListView(showMsg, FALSE);
|
|
|
else
|
|
|
{
|
|
@@ -2067,7 +2022,7 @@ void CControlView::OnCommitResult(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*w
|
|
|
if (rc != Error_Succeed)
|
|
|
{
|
|
|
MessageBoxA(CSimpleStringA::Format("重置终端计数失败(0x%X)", rc));
|
|
|
- LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置终端计数失败(0x%X)", rc));
|
|
|
+ LogWarn(Severity_Middle, rc, 0, CSimpleStringA::Format("重置终端计数失败(0x%X)", rc));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -2091,7 +2046,7 @@ void CControlView::OnCommitResult(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*w
|
|
|
else
|
|
|
{
|
|
|
MessageBoxA(CSimpleStringA::Format("重置后端计数失败(0x%X)", rc));
|
|
|
- LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置后端计数失败(0x%X)", rc));
|
|
|
+ LogWarn(Severity_Middle, rc, 0, CSimpleStringA::Format("重置后端计数失败(0x%X)", rc));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2670,11 +2625,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
|
|
|
|
CenterWindow();
|
|
|
|
|
|
-#ifdef ALL_FUNCTION_SHOW
|
|
|
- OnShowMaintainView(1, 1, 1);
|
|
|
- OnShowMaintainView(1, 1, 1);
|
|
|
-#endif
|
|
|
-
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2801,6 +2751,7 @@ void CMainFrame::OnStartEntityFinished(ErrorCodeEnum ErrorResult, const char *en
|
|
|
{
|
|
|
if (ErrorResult == Error_Succeed) {
|
|
|
output_printf("start %s entity ok!\r\n", entity_name);
|
|
|
+
|
|
|
} else {
|
|
|
output_printf("start %s entity failed! Error = 0x%08X \r\n", entity_name, ErrorResult);
|
|
|
}
|
|
@@ -3248,12 +3199,6 @@ void CMainFrame::OnInitialize(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/
|
|
|
m_pConsole->BeginInitialize();
|
|
|
}
|
|
|
|
|
|
-void CMainFrame::OnMobileDial(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/)
|
|
|
-{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin show mobiledial dialog...");
|
|
|
- m_pConsole->ShowMobileDialog();
|
|
|
-}
|
|
|
-
|
|
|
void CMainFrame::OnDeleteKeySet(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("delete keyset...");
|
|
@@ -3517,6 +3462,15 @@ void CMainFrame::OnStartMenuRange(UINT uNotifyCode, int nID, CWindow wndCtl)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+LRESULT CMainFrame::OnChangeStartState(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
+{
|
|
|
+ LOG_FUNCTION();
|
|
|
+ ShowWindow(SW_SHOW);
|
|
|
+ m_bStarted = true;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
void CCommandEdit::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags )
|
|
|
{
|
|
|
if (nChar == VK_RETURN) {
|
|
@@ -3560,3 +3514,307 @@ void CCommandEdit::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+LRESULT StartPageDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
+{
|
|
|
+ LOG_FUNCTION();
|
|
|
+
|
|
|
+ MoveWindow(0, 0, 960, 610);
|
|
|
+
|
|
|
+ CRect rc;
|
|
|
+ GetWindowRect(&rc);
|
|
|
+
|
|
|
+
|
|
|
+ GetDlgItem(IDC_STATIC1).MoveWindow(rc.left + 40, rc.top + 38, 187, 24);
|
|
|
+ GetDlgItem(IDC_STATIC2).MoveWindow(rc.left + 385, rc.top + 97, 108, 39);
|
|
|
+ GetDlgItem(IDC_EXITVTM).MoveWindow(rc.left + 67, rc.top + 550, 38, 30);
|
|
|
+ GetDlgItem(IDC_PROGRESS).MoveWindow(rc.left + 493, rc.top + 97, 80, 39);
|
|
|
+ GetDlgItem(IDC_STATIC_BASICINFO).MoveWindow(rc.left +800, rc.top + 540, 140, 60);
|
|
|
+
|
|
|
+ m_pOutput = new COutputList();
|
|
|
+ RECT rect;
|
|
|
+ SetRect(&rect, rc.left + 70, rc.top + 168, rc.left + 70 + 820, rc.top + 168 + 367);
|
|
|
+ m_pOutput->Create(m_hWnd, rect, "", WS_VISIBLE | WS_CHILD | LBS_OWNERDRAWVARIABLE | LVS_REPORT
|
|
|
+ | LBS_HASSTRINGS);
|
|
|
+ m_pOutput->ModifyStyle(NULL, WS_HSCROLL | WS_VSCROLL);
|
|
|
+
|
|
|
+ CSimpleStringA basicInoShowText(CSimpleStringA("v") + m_baseInfo.strSoftwareVersion + "\r\n" + m_baseInfo.strTerminalNo + "\r\n" + m_baseInfo.strMachineType);
|
|
|
+ GetDlgItem(IDC_STATIC_BASICINFO).SetWindowTextA(basicInoShowText.GetData());
|
|
|
+ CenterWindow();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+LRESULT StartPageDlg::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
+{
|
|
|
+ CRect rc;
|
|
|
+ POINT pt;
|
|
|
+
|
|
|
+ pt.x = GET_X_LPARAM(lParam);
|
|
|
+ pt.y = GET_Y_LPARAM(lParam);
|
|
|
+ GetClientRect(&rc);
|
|
|
+ ClientToScreen(&rc);
|
|
|
+
|
|
|
+ return rc.PtInRect(pt) ? HTCAPTION : 0;
|
|
|
+}
|
|
|
+
|
|
|
+LRESULT StartPageDlg::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
+{
|
|
|
+ LOG_FUNCTION();
|
|
|
+ DestroyWindow();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+HBRUSH StartPageDlg::OnCtlColorDlg(CDCHandle dc, CWindow wnd)
|
|
|
+{
|
|
|
+ if (m_hWnd == wnd.m_hWnd)
|
|
|
+ {
|
|
|
+ dc.SetBkColor(RGB(0,0,0));
|
|
|
+ return (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
+ } else {
|
|
|
+ SetMsgHandled(FALSE);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+HBRUSH StartPageDlg::OnCtlColorStatic( CDCHandle dc, CStatic wndStatic)
|
|
|
+{
|
|
|
+ if (GetDlgItem(IDC_STATIC2).m_hWnd == wndStatic.m_hWnd) {
|
|
|
+ dc.SetTextColor(RGB(51, 51, 51));
|
|
|
+ dc.SetBkColor(RGB(255, 255, 255));
|
|
|
+ CFont font;
|
|
|
+ font.CreateFontA(30, 0, 0, 0, FW_HEAVY, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_CHARACTER_PRECIS,
|
|
|
+ CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, FF_SWISS, "微软雅黑");
|
|
|
+ dc.SelectFont(font);
|
|
|
+
|
|
|
+ return (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
+ } else if (GetDlgItem(IDC_EXITVTM).m_hWnd == wndStatic.m_hWnd) {
|
|
|
+ dc.SetTextColor(RGB(77, 123, 254));
|
|
|
+ dc.SetBkColor(RGB(255, 255, 255));
|
|
|
+ CFont font;
|
|
|
+ font.CreateFontA(22, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_CHARACTER_PRECIS,
|
|
|
+ CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, FF_SWISS, "微软雅黑");
|
|
|
+ dc.SelectFont(font);
|
|
|
+ return (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
+ } else if (GetDlgItem(IDC_STATIC_BASICINFO).m_hWnd == wndStatic.m_hWnd) {
|
|
|
+ dc.SetTextColor(RGB(169, 169, 169));
|
|
|
+ dc.SetBkColor(RGB(255, 255, 255));
|
|
|
+ CFont font;
|
|
|
+ font.CreateFontA(20, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_CHARACTER_PRECIS,
|
|
|
+ CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, FF_SWISS, "微软雅黑");
|
|
|
+ dc.SelectFont(font);
|
|
|
+ return (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
+ }
|
|
|
+ SetMsgHandled(FALSE);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+LRESULT StartPageDlg::OnStnClickedStatic3(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
|
|
+{
|
|
|
+ m_pStartTask->ReqFrameworkQuit(false);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+void StartPageDlg::OutPut(const char* msg, COLORREF rgb)
|
|
|
+{
|
|
|
+ CString str(msg);
|
|
|
+
|
|
|
+ //m_pOutput->SetItemHeight(m_pOutput->GetCount() - 1, 21);
|
|
|
+
|
|
|
+ CRect rc;
|
|
|
+ m_pOutput->GetClientRect(&rc);
|
|
|
+ int maxWidth = rc.Width();
|
|
|
+ int len = str.GetLength();
|
|
|
+
|
|
|
+ CClientDC dc(m_pOutput->m_hWnd);
|
|
|
+
|
|
|
+ SIZE strsz = {0};
|
|
|
+ GetTextExtentPoint32((HDC)dc.m_hDC, str, len, &strsz);
|
|
|
+
|
|
|
+ if(strsz.cx == 0)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if(strsz.cx < maxWidth - 50)
|
|
|
+ {
|
|
|
+ m_pOutput->AddString(str, rgb);
|
|
|
+ m_pOutput->SetItemHeight(m_pOutput->GetCount() - 1, 21);
|
|
|
+ m_pOutput->SetCurSel(m_pOutput->GetCount() - 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ while(strsz.cx >= maxWidth - 50)
|
|
|
+ {
|
|
|
+ len--;
|
|
|
+ GetTextExtentPoint32((HDC)dc.m_hDC, str, len, &strsz);
|
|
|
+ }
|
|
|
+
|
|
|
+ m_pOutput->AddString(str.Left(len), rgb);
|
|
|
+ m_pOutput->SetItemHeight(m_pOutput->GetCount() - 1, 21);
|
|
|
+ m_pOutput->AddString(str.Right(str.GetLength() - len), rgb);
|
|
|
+ m_pOutput->SetItemHeight(m_pOutput->GetCount() - 1, 21);
|
|
|
+ m_pOutput->SetCurSel(m_pOutput->GetCount() - 1);
|
|
|
+}
|
|
|
+
|
|
|
+LRESULT StartPageDlg::OnShowMsg( UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|
|
+{
|
|
|
+ char *pMsg = (char*)wParam;
|
|
|
+ COLORREF rgb = (COLORREF)lParam;
|
|
|
+
|
|
|
+ OutPut(pMsg, rgb);
|
|
|
+
|
|
|
+ delete pMsg;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+LRESULT StartPageDlg::OnShowProgress(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
+{
|
|
|
+ int idleNum, totalNum;
|
|
|
+ m_pStartTask->GetIdleEntityNum(idleNum, totalNum);
|
|
|
+ CSimpleStringA csProgress = CSimpleString::Format("(%d/%d)", idleNum, totalNum);
|
|
|
+ GetDlgItem(IDC_PROGRESS).SetWindowTextA(csProgress.GetData());
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+HBRUSH StartPageDlg::OnCtlColorProgress( CDCHandle dc, CStatic wndStatic)
|
|
|
+{
|
|
|
+ if (GetDlgItem(IDC_PROGRESS).m_hWnd == wndStatic.m_hWnd) {
|
|
|
+ dc.SetTextColor(RGB(51, 51, 51));
|
|
|
+ dc.SetBkColor(RGB(255, 255, 255));
|
|
|
+ CFont font;
|
|
|
+ font.CreateFontA(30, 0, 0, 0, FW_HEAVY, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_CHARACTER_PRECIS,
|
|
|
+ CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, FF_SWISS, "微软雅黑");
|
|
|
+ dc.SelectFont(font);
|
|
|
+
|
|
|
+ return (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
+ }else {
|
|
|
+ SetMsgHandled(FALSE);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void COutputList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
|
|
|
+{
|
|
|
+ if ((int)lpDIS->itemID < 0)
|
|
|
+ return;
|
|
|
+
|
|
|
+ CDCHandle pDC(lpDIS->hDC);
|
|
|
+
|
|
|
+ COLORREF crText;
|
|
|
+ CString sText;
|
|
|
+ COLORREF crNorm = (COLORREF)lpDIS->itemData; // Color information is in item data.
|
|
|
+ COLORREF crHilite = RGB(255-GetRValue(crNorm), 255-GetGValue(crNorm), 255-GetBValue(crNorm));
|
|
|
+
|
|
|
+ // If item has been selected, draw the highlight rectangle using the item's color.
|
|
|
+ if ((lpDIS->itemState & ODS_SELECTED) &&
|
|
|
+ (lpDIS->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
|
|
|
+ {
|
|
|
+ pDC.FillSolidRect(&lpDIS->rcItem, crNorm);
|
|
|
+ }
|
|
|
+
|
|
|
+ // If item has been deselected, draw the rectangle using the window color.
|
|
|
+ if (!(lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemAction & ODA_SELECT))
|
|
|
+ {
|
|
|
+ pDC.FillSolidRect(&lpDIS->rcItem, ::GetSysColor(COLOR_WINDOW));
|
|
|
+ }
|
|
|
+
|
|
|
+ // If item has focus, draw the focus rect.
|
|
|
+ if ((lpDIS->itemAction & ODA_FOCUS) && (lpDIS->itemState & ODS_FOCUS))
|
|
|
+ pDC.DrawFocusRect(&lpDIS->rcItem);
|
|
|
+
|
|
|
+ // If item does not have focus, redraw (erase) the focus rect.
|
|
|
+ if ((lpDIS->itemAction & ODA_FOCUS) && !(lpDIS->itemState & ODS_FOCUS))
|
|
|
+ pDC.DrawFocusRect(&lpDIS->rcItem);
|
|
|
+
|
|
|
+
|
|
|
+ // Set the background mode to TRANSPARENT to draw the text.
|
|
|
+ int nBkMode = pDC.SetBkMode(TRANSPARENT);
|
|
|
+
|
|
|
+ // If the item's color information is set, use the highlight color
|
|
|
+ // gray text color, or normal color for the text.
|
|
|
+ if (lpDIS->itemData)
|
|
|
+ {
|
|
|
+ if (lpDIS->itemState & ODS_SELECTED)
|
|
|
+ crText = pDC.SetTextColor(crHilite);
|
|
|
+ else if (lpDIS->itemState & ODS_DISABLED)
|
|
|
+ crText = pDC.SetTextColor(::GetSysColor(COLOR_GRAYTEXT));
|
|
|
+ else
|
|
|
+ crText = pDC.SetTextColor(crNorm);
|
|
|
+ }
|
|
|
+ // Else the item's color information is not set, so use the
|
|
|
+ // system colors for the text.
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (lpDIS->itemState & ODS_SELECTED)
|
|
|
+ crText = pDC.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
|
|
|
+ else if (lpDIS->itemState & ODS_DISABLED)
|
|
|
+ crText = pDC.SetTextColor(::GetSysColor(COLOR_GRAYTEXT));
|
|
|
+ else
|
|
|
+ crText = pDC.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // Get and display item text.
|
|
|
+ GetText(lpDIS->itemID, sText);
|
|
|
+ CRect rect = lpDIS->rcItem;
|
|
|
+
|
|
|
+ // Setup the text format.
|
|
|
+ UINT nFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER;
|
|
|
+ if (GetStyle() & LBS_USETABSTOPS)
|
|
|
+ nFormat |= DT_EXPANDTABS;
|
|
|
+
|
|
|
+ // Calculate the rectangle size before drawing the text.
|
|
|
+ CFont font;
|
|
|
+ font.CreateFontA(20, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_CHARACTER_PRECIS,
|
|
|
+ CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, FF_SWISS, "微软雅黑");
|
|
|
+
|
|
|
+ pDC.SelectFont(font);
|
|
|
+
|
|
|
+ pDC.DrawText(sText, -1, &rect, nFormat | DT_CALCRECT);
|
|
|
+ pDC.DrawText(sText, -1, &rect, nFormat);
|
|
|
+
|
|
|
+ pDC.SetTextColor(crText);
|
|
|
+ pDC.SetBkMode(nBkMode);
|
|
|
+}
|
|
|
+
|
|
|
+void COutputList::MeasureItem(LPMEASUREITEMSTRUCT lpMIS)
|
|
|
+{
|
|
|
+ lpMIS->itemHeight = ::GetSystemMetrics(SM_CXMENUCHECK);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("lpMIS->itemHeight=%d", lpMIS->itemHeight);
|
|
|
+}
|
|
|
+
|
|
|
+int COutputList::AddString(LPCTSTR lpszItem)
|
|
|
+{
|
|
|
+ return ((CListBox*)this)->AddString(lpszItem);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+int COutputList::AddString(LPCTSTR lpszItem, COLORREF rgb)
|
|
|
+{
|
|
|
+ int nItem = AddString(lpszItem);
|
|
|
+ if (nItem >= 0)
|
|
|
+ SetItemData(nItem, rgb);
|
|
|
+ return nItem;
|
|
|
+}
|
|
|
+
|
|
|
+int COutputList::InsertString(int nIndex, LPCTSTR lpszItem)
|
|
|
+{
|
|
|
+ return ((CListBox*)this)->InsertString(nIndex, lpszItem);
|
|
|
+}
|
|
|
+
|
|
|
+int COutputList::InsertString(int nIndex, LPCTSTR lpszItem, COLORREF rgb)
|
|
|
+{
|
|
|
+ int nItem = ((CListBox*)this)->InsertString(nIndex,lpszItem);
|
|
|
+ if (nItem >= 0)
|
|
|
+ SetItemData(nItem, rgb);
|
|
|
+ return nItem;
|
|
|
+}
|
|
|
+
|
|
|
+void COutputList::SetItemColor(int nIndex, COLORREF rgb)
|
|
|
+{
|
|
|
+
|
|
|
+ SetItemData(nIndex, rgb);
|
|
|
+
|
|
|
+ RedrawWindow();
|
|
|
+}
|