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

Function Style_Load

src/Styles.c:1103–1170  ·  view source on GitHub ↗

============================================================================= Style_Load()

Source from the content-addressed store, hash-verified

1101// Style_Load()
1102//
1103void Style_Load()
1104{
1105 int i, iLexer;
1106 WCHAR tch[32];
1107 WCHAR *pIniSection = LocalAlloc ( LPTR, sizeof ( WCHAR ) * 32 * 1024 );
1108 int cchIniSection = ( int ) LocalSize ( pIniSection ) / sizeof ( WCHAR );
1109 // Custom colors
1110 crCustom [0] = RGB ( 0x00, 0x00, 0x00 );
1111 crCustom [1] = RGB ( 0x0A, 0x24, 0x6A );
1112 crCustom [2] = RGB ( 0x3A, 0x6E, 0xA5 );
1113 crCustom [3] = RGB ( 0x00, 0x3C, 0xE6 );
1114 crCustom [4] = RGB ( 0x00, 0x66, 0x33 );
1115 crCustom [5] = RGB ( 0x60, 0x80, 0x20 );
1116 crCustom [6] = RGB ( 0x64, 0x80, 0x00 );
1117 crCustom [7] = RGB ( 0xA4, 0x60, 0x00 );
1118 crCustom [8] = RGB ( 0xFF, 0xFF, 0xFF );
1119 crCustom [9] = RGB ( 0xFF, 0xFF, 0xE2 );
1120 crCustom[10] = RGB ( 0xFF, 0xF1, 0xA8 );
1121 crCustom[11] = RGB ( 0xFF, 0xC0, 0x00 );
1122 crCustom[12] = RGB ( 0xFF, 0x40, 0x00 );
1123 crCustom[13] = RGB ( 0xC8, 0x00, 0x00 );
1124 crCustom[14] = RGB ( 0xB0, 0x00, 0xB0 );
1125 crCustom[15] = RGB ( 0xB2, 0x8B, 0x40 );
1126 LoadIniSection ( L"Custom Colors", pIniSection, cchIniSection );
1127 for ( i = 0; i < 16; i++ ) {
1128 int itok;
1129 int irgb;
1130 WCHAR wch[32];
1131 wsprintf ( tch, L"%02i", i + 1 );
1132 if ( IniSectionGetString ( pIniSection, tch, L"", wch, COUNTOF ( wch ) ) ) {
1133 if ( wch[0] == L'#' ) {
1134 itok = swscanf ( CharNext ( wch ), L"%x", &irgb );
1135 if ( itok == 1 ) {
1136 crCustom[i] = RGB ( ( irgb & 0xFF0000 ) >> 16, ( irgb & 0xFF00 ) >> 8, irgb & 0xFF );
1137 }
1138 }
1139 }
1140 }
1141 LoadIniSection ( L"Styles", pIniSection, cchIniSection );
1142 // 2nd default
1143 bUse2ndDefaultStyle = ( IniSectionGetInt ( pIniSection, L"Use2ndDefaultStyle", 0 ) ) ? 1 : 0;
1144 // default scheme
1145 iDefaultLexer = IniSectionGetInt ( pIniSection, L"DefaultScheme", 0 );
1146 iDefaultLexer = min ( max ( iDefaultLexer, 0 ), NUMLEXERS - 1 );
1147 // auto select
1148 bAutoSelect = ( IniSectionGetInt ( pIniSection, L"AutoSelect", 1 ) ) ? 1 : 0;
1149 // scheme select dlg dimensions
1150 cxStyleSelectDlg = IniSectionGetInt ( pIniSection, L"SelectDlgSizeX", 304 );
1151 cxStyleSelectDlg = max ( cxStyleSelectDlg, 0 );
1152 cyStyleSelectDlg = IniSectionGetInt ( pIniSection, L"SelectDlgSizeY", 0 );
1153 cyStyleSelectDlg = max ( cyStyleSelectDlg, 324 );
1154 for ( iLexer = 0; iLexer < NUMLEXERS; iLexer++ ) {
1155 LoadIniSection ( pLexArray[iLexer]->pszName, pIniSection, cchIniSection );
1156 if ( !IniSectionGetString ( pIniSection, L"FileNameExtensions", pLexArray[iLexer]->pszDefExt,
1157 pLexArray[iLexer]->szExtensions, COUNTOF ( pLexArray[iLexer]->szExtensions ) ) )
1158 lstrcpyn ( pLexArray[iLexer]->szExtensions, pLexArray[iLexer]->pszDefExt,
1159 COUNTOF ( pLexArray[iLexer]->szExtensions ) );
1160 i = 0;

Callers 1

LoadSettingsFunction · 0.85

Calls 2

IniSectionGetStringFunction · 0.85
IniSectionGetIntFunction · 0.85

Tested by

no test coverage detected