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

Function Style_SetLexer

src/Styles.c:1319–2017  ·  view source on GitHub ↗

============================================================================= Style_SetLexer()

Source from the content-addressed store, hash-verified

1317// Style_SetLexer()
1318//
1319void Style_SetLexer ( HWND hwnd, PEDITLEXER pLexNew )
1320{
1321#if 0
1322 int i;
1323 //WCHAR *p;
1324 int rgb;
1325 int iValue;
1326 int iIdx;
1327 int iStyleBits;
1328 WCHAR wchCaretStyle[64] = L"";
1329 // Select default if NULL is specified
1330 if ( !pLexNew ) {
1331 pLexNew = pLexArray[iDefaultLexer];
1332 }
1333 // Lexer
1334 SendMessage ( hwnd, SCI_SETLEXER, pLexNew->iLexer, 0 );
1335 iStyleBits = ( int ) SendMessage ( hwnd, SCI_GETSTYLEBITSNEEDED, 0, 0 );
1336 SendMessage ( hwnd, SCI_SETSTYLEBITS, ( WPARAM ) iStyleBits, 0 );
1337 if ( pLexNew->iLexer == SCLEX_XML ) {
1338 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "lexer.xml.allow.scripts", ( LPARAM ) "1" );
1339 }
1340 if ( pLexNew->iLexer == SCLEX_CPP ) {
1341 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "styling.within.preprocessor", ( LPARAM ) "1" );
1342 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "lexer.cpp.track.preprocessor", ( LPARAM ) "0" );
1343 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "lexer.cpp.update.preprocessor", ( LPARAM ) "0" );
1344 } else if ( pLexNew->iLexer == SCLEX_PASCAL ) {
1345 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "lexer.pascal.smart.highlighting", ( LPARAM ) "1" );
1346 } else if ( pLexNew->iLexer == SCLEX_SQL ) {
1347 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "sql.backslash.escapes", ( LPARAM ) "1" );
1348 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "lexer.sql.backticks.identifier", ( LPARAM ) "1" );
1349 SendMessage ( hwnd, SCI_SETPROPERTY, ( WPARAM ) "lexer.sql.numbersign.comment", ( LPARAM ) "1" );
1350 } else if ( pLexNew->iLexer == SCLEX_CSS ) {
1351 }
1352 // Add KeyWord Lists
1353 for ( i = 0; i < 9; i++ ) {
1354 SendMessage ( hwnd, SCI_SETKEYWORDS, i, ( LPARAM ) pLexNew->pKeyWords->pszKeyWords[i] );
1355 }
1356 // Use 2nd default style
1357 iIdx = ( bUse2ndDefaultStyle ) ? 12 : 0;
1358 // Font quality setup, check availability of Consolas
1359 Style_SetFontQuality ( hwnd, lexDefault.Styles[0 + iIdx].szValue );
1360 fIsConsolasAvailable = IsFontAvailable ( L"Consolas" );
1361 // Clear
1362 SendMessage ( hwnd, SCI_CLEARDOCUMENTSTYLE, 0, 0 );
1363 // Default Values are always set
1364 SendMessage ( hwnd, SCI_STYLERESETDEFAULT, 0, 0 );
1365 SendMessage ( hwnd, SCI_STYLESETCHARACTERSET, STYLE_DEFAULT, ( LPARAM ) DEFAULT_CHARSET );
1366 iBaseFontSize = 10;
1367 Style_SetStyles ( hwnd, lexDefault.Styles[0 + iIdx].iStyle, lexDefault.Styles[0 + iIdx].szValue ); // default
1368 Style_StrGetSize ( lexDefault.Styles[0 + iIdx].szValue, &iBaseFontSize ); // base size
1369 // Auto-select codepage according to charset
1370 //Style_SetACPfromCharSet(hwnd);
1371 if ( !Style_StrGetColor ( TRUE, lexDefault.Styles[0 + iIdx].szValue, &iValue ) ) {
1372 SendMessage ( hwnd, SCI_STYLESETFORE, STYLE_DEFAULT, ( LPARAM ) GetSysColor ( COLOR_WINDOWTEXT ) ); // default text color
1373 }
1374 if ( !Style_StrGetColor ( FALSE, lexDefault.Styles[0 + iIdx].szValue, &iValue ) ) {
1375 SendMessage ( hwnd, SCI_STYLESETBACK, STYLE_DEFAULT, ( LPARAM ) GetSysColor ( COLOR_WINDOW ) ); // default window color
1376 }

Callers 13

Style_SetLexerFromFileFunction · 0.85
Style_SetLexerFromNameFunction · 0.85
Style_SetDefaultLexerFunction · 0.85
Style_SetHTMLLexerFunction · 0.85
Style_SetXMLLexerFunction · 0.85
Style_SetLexerFromIDFunction · 0.85
Style_SetDefaultFontFunction · 0.85
Style_ConfigDlgProcFunction · 0.85
Style_ConfigDlgFunction · 0.85
Style_SelectLexerDlgFunction · 0.85
MainWndProcFunction · 0.85

Calls 8

Style_SetFontQualityFunction · 0.85
IsFontAvailableFunction · 0.85
Style_SetStylesFunction · 0.85
Style_StrGetSizeFunction · 0.85
Style_StrGetColorFunction · 0.85
Style_StrGetAlphaFunction · 0.85
VerifyContrastFunction · 0.85
Style_SetIndentGuidesFunction · 0.85

Tested by

no test coverage detected