MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / CTWndProc

Method CTWndProc

scintilla/win32/ScintillaWin.cxx:2900–2996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2898}
2899
2900sptr_t PASCAL ScintillaWin::CTWndProc (
2901 HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam )
2902{
2903 // Find C++ object associated with window.
2904 ScintillaWin *sciThis = reinterpret_cast<ScintillaWin *> ( PointerFromWindow ( hWnd ) );
2905 try {
2906 // ctp will be zero if WM_CREATE not seen yet
2907 if ( sciThis == 0 ) {
2908 if ( iMessage == WM_CREATE ) {
2909 // Associate CallTip object with window
2910 CREATESTRUCT *pCreate = reinterpret_cast<CREATESTRUCT *> ( lParam );
2911 SetWindowPointer ( hWnd, pCreate->lpCreateParams );
2912 return 0;
2913 } else {
2914 return ::DefWindowProc ( hWnd, iMessage, wParam, lParam );
2915 }
2916 } else {
2917 if ( iMessage == WM_NCDESTROY ) {
2918 ::SetWindowLong ( hWnd, 0, 0 );
2919 return ::DefWindowProc ( hWnd, iMessage, wParam, lParam );
2920 } else if ( iMessage == WM_PAINT ) {
2921 PAINTSTRUCT ps;
2922 ::BeginPaint ( hWnd, &ps );
2923 Surface *surfaceWindow = Surface::Allocate ( sciThis->technology );
2924 if ( surfaceWindow ) {
2925#if defined(USE_D2D)
2926 ID2D1HwndRenderTarget *pCTRenderTarget = 0;
2927#endif
2928 RECT rc;
2929 GetClientRect ( hWnd, &rc );
2930 // Create a Direct2D render target.
2931 if ( sciThis->technology == SC_TECHNOLOGY_DEFAULT ) {
2932 surfaceWindow->Init ( ps.hdc, hWnd );
2933 } else {
2934#if defined(USE_D2D)
2935 D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp;
2936 dhrtp.hwnd = hWnd;
2937 dhrtp.pixelSize = D2D1::SizeU ( rc.right - rc.left, rc.bottom - rc.top );
2938 dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE;
2939 D2D1_RENDER_TARGET_PROPERTIES drtp;
2940 drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
2941 drtp.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
2942 drtp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_UNKNOWN;
2943 drtp.dpiX = 96.0;
2944 drtp.dpiY = 96.0;
2945 drtp.usage = D2D1_RENDER_TARGET_USAGE_NONE;
2946 drtp.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
2947 pD2DFactory->CreateHwndRenderTarget ( drtp, dhrtp, &pCTRenderTarget );
2948 surfaceWindow->Init ( pCTRenderTarget, hWnd );
2949 pCTRenderTarget->BeginDraw();
2950#endif
2951 }
2952 surfaceWindow->SetUnicodeMode ( SC_CP_UTF8 == sciThis->ct.codePage );
2953 surfaceWindow->SetDBCSMode ( sciThis->ct.codePage );
2954 sciThis->ct.PaintCT ( surfaceWindow );
2955#if defined(USE_D2D)
2956 if ( pCTRenderTarget ) {
2957 pCTRenderTarget->EndDraw();

Callers

nothing calls this directly

Calls 10

PointClass · 0.85
SetUnicodeModeMethod · 0.80
SetDBCSModeMethod · 0.80
PaintCTMethod · 0.80
MouseClickMethod · 0.80
CallTipClickMethod · 0.80
PointerFromWindowFunction · 0.70
SetWindowPointerFunction · 0.70
InitMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected