void CTextWnd::SetText (const char *pszText) { // // Reset the lines // m_asLines .RemoveAll (); // // Save the text // m_strText = pszText; pszText = m_strText; // // Create the line array // const char *pachStart = m_strText; const char *pachEnd = &pachStart [m_strText .GetLength ()]; m_nMaxLength = 0; while (pachStart < pachEnd) { const char *pachLine = pachStart; while (pachStart < pachEnd) { if (*pachStart == '\r' || *pachStart == '\n') break; pachStart++; } { TextLine2 tl; tl .pachStart = pachLine; tl .nLength = pachStart - pachLine; m_asLines .Add (tl); if (tl .nLength > m_nMaxLength) m_nMaxLength = tl .nLength; } if (pachStart < pachEnd) { if (pachStart + 1 < pachEnd && pachStart [0] == '\r' && pachStart [1] == '\n') pachStart += 2; else pachStart++; } } m_sizeTotal .cx = m_nMaxLength; m_sizeTotal .cx *= g_sizeFixed .cx; m_sizeTotal .cy = (int) m_asLines .GetCount (); m_sizeTotal .cy *= g_sizeFixed .cy; SetScrollOffset (0, 0, TRUE); SetScrollSize (1, 1, TRUE);//Seems to fix a SB update problem on XP SetScrollSize (m_sizeTotal); SetScrollLine (g_sizeFixed); SetScrollPage (m_sizeClient); }
LRESULT CTextViewImpl::OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { // // Create the line array // char *pachStart = GetData (); char *pachEnd = &pachStart [GetSize ()]; m_nMaxLength = 0; while (pachStart < pachEnd) { char *pachLine = pachStart; while (pachStart < pachEnd) { if (*pachStart == '\r' || *pachStart == '\n') break; pachStart++; } { TextLine tl; tl .pachStart = pachLine; tl .nLength = pachStart - pachLine; m_asLines .Add (tl); if (tl .nLength > m_nMaxLength) m_nMaxLength = tl .nLength; } if (pachStart < pachEnd) { if (pachStart + 1 < pachEnd && pachStart [0] == '\r' && pachStart [1] == '\n') pachStart += 2; else pachStart++; } } m_sizeTotal .cx = m_nMaxLength; m_sizeTotal .cx *= g_sizeFixed .cx; m_sizeTotal .cy = (int) m_asLines .GetCount (); m_sizeTotal .cy *= g_sizeFixed .cy; SetScrollOffset (0, 0, FALSE); SetScrollSize (m_sizeTotal); SetScrollLine (g_sizeFixed); // // Return FALSE // return false; }
LRESULT CTextWnd::OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { SetScrollSize (CSize (1, 1)); SetScrollLine (g_sizeFixed); // // Return FALSE // return false; }
LRESULT CHexView::OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { m_sizeTotal .cx = (9 + (16 * 3) + 16); m_sizeTotal .cx *= g_sizeFixed .cx; m_sizeTotal .cy = (m_sRes .GetSize () + 15) / 16; m_sizeTotal .cy *= g_sizeFixed .cy; SetScrollOffset (0, 0, FALSE); SetScrollSize (m_sizeTotal); SetScrollLine (g_sizeFixed); // // Return FALSE // return false; }
/** * @param hWnd - handle to the control to receive the default keyboard focus. * @param lParam - specifies additional initialization data. * @return message result code. */ LRESULT CManualModeDlg::OnInitDialog(HWND /*hWnd*/, LPARAM /*lParam*/) { m_txtMapPdbFile.Attach(GetDlgItem(IDC_MAPPDBFILE)); m_txtMapPdbFile.SetLimitText(MAX_PATH - 1); m_txtBaseAddress.Attach(GetDlgItem(IDC_BASEADDRESS), GetDlgItem(IDC_BASEADDRESS_RADIX)); CNumEdit& txtBaseAddress = m_txtBaseAddress.GetNumEdit(); txtBaseAddress.SetLimitText(8); txtBaseAddress.SetNumFormat(CNumEdit::NF_HEX); CNumEdit& txtModuleSize = m_txtModuleSize.GetNumEdit(); m_txtModuleSize.Attach(GetDlgItem(IDC_MODULESIZE), GetDlgItem(IDC_MODULESIZE_RADIX)); txtModuleSize.SetLimitText(8); txtModuleSize.SetNumFormat(CNumEdit::NF_HEX); txtModuleSize.EnableWindow(FALSE); CNumEdit& txtCrashAddress = m_txtCrashAddress.GetNumEdit(); m_txtCrashAddress.Attach(GetDlgItem(IDC_CRASHADDRESS), GetDlgItem(IDC_CRASHADDRESS_RADIX)); txtCrashAddress.SetLimitText(8); txtCrashAddress.SetNumFormat(CNumEdit::NF_HEX); m_txtFunctionName.Attach(GetDlgItem(IDC_FUNCTIONNAME)); m_txtSourceFile.Attach(GetDlgItem(IDC_SOURCEFILE)); m_txtLineNumber.Attach(GetDlgItem(IDC_LINENUMBER)); ////////////////////////////////////////////////////////////// // workaround for WinXP bug when scrollbars are not skinned // LONG lStyle = GetWindowLong(GWL_STYLE); // SetWindowLong(GWL_STYLE, lStyle | WS_HSCROLL | WS_VSCROLL); // SetWindowLong(GWL_STYLE, lStyle); // ////////////////////////////////////////////////////////////// InitLayout(false, true); AddControlsToLayout(g_arrLayout, countof(g_arrLayout)); CRect rcClient; GetClientRect(&rcClient); SetScrollSize(rcClient.right, rcClient.bottom); DWORD dwDlgUnits = GetDialogBaseUnits(); int nLineUnit = HIWORD(dwDlgUnits); SetScrollLine(nLineUnit, nLineUnit); ClearProcessor(); return TRUE; }
/** * @param hWnd - handle to the control to receive the default keyboard focus. * @param lParam - specifies additional initialization data. * @return message result code. */ LRESULT CExpressModeDlg::OnInitDialog(HWND /*hWnd*/, LPARAM /*lParam*/) { m_rxFunctionName.assign("([0-9A-Za-z_:]+)\\(.*\\)"); m_txtLogFile.Attach(GetDlgItem(IDC_LOGFILE)); m_txtLogFile.SetLimitText(MAX_PATH - 1); m_txtMapPdbFolder.Attach(GetDlgItem(IDC_MAPPDBFOLDER)); m_txtMapPdbFolder.SetLimitText(MAX_PATH - 1); m_txtErrorReason.Attach(GetDlgItem(IDC_ERROR_REASON)); m_lstStackTrace.Attach(GetDlgItem(IDC_STACK_TRACE)); m_lstStackTrace.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP); ////////////////////////////////////////////////////////////// // workaround for WinXP bug when scrollbars are not skinned // LONG lStyle = GetWindowLong(GWL_STYLE); // SetWindowLong(GWL_STYLE, lStyle | WS_HSCROLL | WS_VSCROLL); // SetWindowLong(GWL_STYLE, lStyle); // ////////////////////////////////////////////////////////////// InitLayout(false, true); AddControlsToLayout(g_arrLayout, countof(g_arrLayout)); CRect rcClient; GetClientRect(&rcClient); SetScrollSize(rcClient.right, rcClient.bottom); DWORD dwDlgUnits = GetDialogBaseUnits(); int nLineUnit = HIWORD(dwDlgUnits); SetScrollLine(nLineUnit, nLineUnit); TCHAR szColumnTitle[64]; HINSTANCE hInstance = _Module.GetResourceInstance(); CRect rcList; m_lstStackTrace.GetClientRect(&rcList); LVCOLUMN lvc; ZeroMemory(&lvc, sizeof(lvc)); lvc.mask = LVCF_TEXT; lvc.pszText = szColumnTitle; LoadString(hInstance, IDS_COLUMN_ADDRESS, szColumnTitle, countof(szColumnTitle)); m_lstStackTrace.InsertColumn(CID_ENTRY_ADDRESS, &lvc); m_lstStackTrace.SetColumnWidth(CID_ENTRY_ADDRESS, rcList.right / 6); LoadString(hInstance, IDS_COLUMN_FUNCTION, szColumnTitle, countof(szColumnTitle)); m_lstStackTrace.InsertColumn(CID_ENTRY_FUNCTION, &lvc); m_lstStackTrace.SetColumnWidth(CID_ENTRY_FUNCTION, rcList.right / 4); LoadString(hInstance, IDS_COLUMN_FILE, szColumnTitle, countof(szColumnTitle)); m_lstStackTrace.InsertColumn(CID_ENTRY_FILE, &lvc); m_lstStackTrace.SetColumnWidth(CID_ENTRY_FILE, rcList.right / 4); LoadString(hInstance, IDS_COLUMN_LINE, szColumnTitle, countof(szColumnTitle)); m_lstStackTrace.InsertColumn(CID_ENTRY_LINE, &lvc); m_lstStackTrace.SetColumnWidth(CID_ENTRY_LINE, rcList.right / 6); LoadString(hInstance, IDS_COLUMN_MODULE, szColumnTitle, countof(szColumnTitle)); m_lstStackTrace.InsertColumn(CID_ENTRY_MODULE, &lvc); m_lstStackTrace.SetColumnWidth(CID_ENTRY_MODULE, rcList.right / 4); return TRUE; }