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

Function Style_SelectLexerDlgProc

src/Styles.c:3493–3668  ·  view source on GitHub ↗

============================================================================= Style_SelectLexerDlgProc()

Source from the content-addressed store, hash-verified

3491// Style_SelectLexerDlgProc()
3492//
3493INT_PTR CALLBACK Style_SelectLexerDlgProc ( HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam )
3494{
3495 static int cxClient;
3496 static int cyClient;
3497 static int mmiPtMaxY;
3498 static int mmiPtMinX;
3499 static HWND hwndLV;
3500 static int iInternalDefault;
3501 switch ( umsg ) {
3502 case WM_INITDIALOG: {
3503 int i;
3504 int lvItems;
3505 LVITEM lvi;
3506 SHFILEINFO shfi;
3507 LVCOLUMN lvc = { LVCF_FMT | LVCF_TEXT, LVCFMT_LEFT, 0, L"", -1, 0, 0, 0 };
3508 RECT rc;
3509 WCHAR tch[MAX_PATH];
3510 int cGrip;
3511 GetClientRect ( hwnd, &rc );
3512 cxClient = rc.right - rc.left;
3513 cyClient = rc.bottom - rc.top;
3514 AdjustWindowRectEx ( &rc, GetWindowLong ( hwnd, GWL_STYLE ) | WS_THICKFRAME, FALSE, 0 );
3515 mmiPtMinX = rc.right - rc.left;
3516 mmiPtMaxY = rc.bottom - rc.top;
3517 if ( cxStyleSelectDlg < ( rc.right - rc.left ) ) {
3518 cxStyleSelectDlg = rc.right - rc.left;
3519 }
3520 if ( cyStyleSelectDlg < ( rc.bottom - rc.top ) ) {
3521 cyStyleSelectDlg = rc.bottom - rc.top;
3522 }
3523 SetWindowPos ( hwnd, NULL, rc.left, rc.top, cxStyleSelectDlg, cyStyleSelectDlg, SWP_NOZORDER );
3524 SetWindowLongPtr ( hwnd, GWL_STYLE, GetWindowLongPtr ( hwnd, GWL_STYLE ) | WS_THICKFRAME );
3525 SetWindowPos ( hwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED );
3526 GetMenuString ( GetSystemMenu ( GetParent ( hwnd ), FALSE ), SC_SIZE, tch, COUNTOF ( tch ), MF_BYCOMMAND );
3527 InsertMenu ( GetSystemMenu ( hwnd, FALSE ), SC_CLOSE, MF_BYCOMMAND | MF_STRING | MF_ENABLED, SC_SIZE, tch );
3528 InsertMenu ( GetSystemMenu ( hwnd, FALSE ), SC_CLOSE, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL );
3529 SetWindowLongPtr ( GetDlgItem ( hwnd, IDC_RESIZEGRIP3 ), GWL_STYLE,
3530 GetWindowLongPtr ( GetDlgItem ( hwnd, IDC_RESIZEGRIP3 ), GWL_STYLE ) | SBS_SIZEGRIP | WS_CLIPSIBLINGS );
3531 cGrip = GetSystemMetrics ( SM_CXHTHUMB );
3532 SetWindowPos ( GetDlgItem ( hwnd, IDC_RESIZEGRIP3 ), NULL, cxClient - cGrip,
3533 cyClient - cGrip, cGrip, cGrip, SWP_NOZORDER );
3534 hwndLV = GetDlgItem ( hwnd, IDC_STYLELIST );
3535 ListView_SetImageList ( hwndLV,
3536 ( HIMAGELIST ) SHGetFileInfo ( L"C:\\", 0, &shfi, sizeof ( SHFILEINFO ), SHGFI_SMALLICON | SHGFI_SYSICONINDEX ),
3537 LVSIL_SMALL );
3538 ListView_SetImageList ( hwndLV,
3539 ( HIMAGELIST ) SHGetFileInfo ( L"C:\\", 0, &shfi, sizeof ( SHFILEINFO ), SHGFI_LARGEICON | SHGFI_SYSICONINDEX ),
3540 LVSIL_NORMAL );
3541 //SetExplorerTheme(hwndLV);
3542 ListView_SetExtendedListViewStyle ( hwndLV,/*LVS_EX_FULLROWSELECT|*/LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP );
3543 ListView_InsertColumn ( hwndLV, 0, &lvc );
3544 // Add lexers
3545 for ( i = 0; i < NUMLEXERS; i++ ) {
3546 Style_AddLexerToListView ( hwndLV, pLexArray[i] );
3547 }
3548 ListView_SetColumnWidth ( hwndLV, 0, LVSCW_AUTOSIZE_USEHEADER );
3549 // Select current lexer
3550 lvItems = ListView_GetItemCount ( hwndLV );

Callers

nothing calls this directly

Calls 4

SetWindowLongPtrFunction · 0.85
GetWindowLongPtrFunction · 0.85
Style_AddLexerToListViewFunction · 0.85
CenterDlgInParentFunction · 0.85

Tested by

no test coverage detected