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

Function Style_Save

src/Styles.c:1177–1219  ·  view source on GitHub ↗

============================================================================= Style_Save()

Source from the content-addressed store, hash-verified

1175// Style_Save()
1176//
1177void Style_Save()
1178{
1179 int i, iLexer;
1180 WCHAR tch[32];
1181 WCHAR *pIniSection = LocalAlloc ( LPTR, sizeof ( WCHAR ) * 32 * 1024 );
1182 int cchIniSection = ( int ) LocalSize ( pIniSection ) / sizeof ( WCHAR );
1183 // Custom colors
1184 for ( i = 0; i < 16; i++ ) {
1185 WCHAR wch[32];
1186 wsprintf ( tch, L"%02i", i + 1 );
1187 wsprintf ( wch, L"#%02X%02X%02X",
1188 ( int ) GetRValue ( crCustom[i] ), ( int ) GetGValue ( crCustom[i] ), ( int ) GetBValue ( crCustom[i] ) );
1189 IniSectionSetString ( pIniSection, tch, wch );
1190 }
1191 SaveIniSection ( L"Custom Colors", pIniSection );
1192 ZeroMemory ( pIniSection, cchIniSection );
1193 // auto select
1194 IniSectionSetInt ( pIniSection, L"Use2ndDefaultStyle", bUse2ndDefaultStyle );
1195 // default scheme
1196 IniSectionSetInt ( pIniSection, L"DefaultScheme", iDefaultLexer );
1197 // auto select
1198 IniSectionSetInt ( pIniSection, L"AutoSelect", bAutoSelect );
1199 // scheme select dlg dimensions
1200 IniSectionSetInt ( pIniSection, L"SelectDlgSizeX", cxStyleSelectDlg );
1201 IniSectionSetInt ( pIniSection, L"SelectDlgSizeY", cyStyleSelectDlg );
1202 SaveIniSection ( L"Styles", pIniSection );
1203 if ( !fStylesModified ) {
1204 LocalFree ( pIniSection );
1205 return;
1206 }
1207 ZeroMemory ( pIniSection, cchIniSection );
1208 for ( iLexer = 0; iLexer < NUMLEXERS; iLexer++ ) {
1209 IniSectionSetString ( pIniSection, L"FileNameExtensions", pLexArray[iLexer]->szExtensions );
1210 i = 0;
1211 while ( pLexArray[iLexer]->Styles[i].iStyle != -1 ) {
1212 IniSectionSetString ( pIniSection, pLexArray[iLexer]->Styles[i].pszName, pLexArray[iLexer]->Styles[i].szValue );
1213 i++;
1214 }
1215 SaveIniSection ( pLexArray[iLexer]->pszName, pIniSection );
1216 ZeroMemory ( pIniSection, cchIniSection );
1217 }
1218 LocalFree ( pIniSection );
1219}
1220
1221
1222//=============================================================================

Callers 1

SaveSettingsFunction · 0.85

Calls 2

IniSectionSetStringFunction · 0.85
IniSectionSetIntFunction · 0.85

Tested by

no test coverage detected