mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ fix: .ini-file - remove some keys with default values (styles)
This commit is contained in:
parent
faea957a01
commit
8a677b24b6
@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set _VERPATCH_=develop
|
||||
set _VERPATCH_=DEV
|
||||
echo."%_VERPATCH_%">.\np3portableapp\_buildname.txt
|
||||
Version -VerPatch "%_VERPATCH_%"
|
||||
endlocal
|
||||
@ -1 +1 @@
|
||||
2384
|
||||
2385
|
||||
|
||||
@ -1 +1 @@
|
||||
"Oniguruma"
|
||||
"DEV"
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.704.2384"
|
||||
version="5.19.706.2385"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 Oniguruma</description>
|
||||
<description>Notepad3 DEV</description>
|
||||
</assembly>
|
||||
|
||||
@ -190,9 +190,9 @@ extern "C" bool IniSectionSetBool(LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool
|
||||
// ============================================================================
|
||||
|
||||
|
||||
extern "C" bool IniSectionDeleteValue(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpValue, bool bRemoveEmpty)
|
||||
extern "C" bool IniSectionDelete(LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bRemoveEmpty)
|
||||
{
|
||||
return s_INI.DeleteValue(lpSectionName, lpKeyName, lpValue, bRemoveEmpty);
|
||||
return s_INI.Delete(lpSectionName, lpKeyName, bRemoveEmpty);
|
||||
}
|
||||
// ============================================================================
|
||||
|
||||
@ -318,13 +318,13 @@ extern "C" bool IniFileSetBool(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWST
|
||||
// ============================================================================
|
||||
|
||||
|
||||
extern "C" bool IniFileDeleteValue(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpValue, bool bRemoveEmpty)
|
||||
extern "C" bool IniFileDelete(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bRemoveEmpty)
|
||||
{
|
||||
CSimpleIni Ini(s_bIsUTF8, s_bUseMultiKey, s_bUseMultiLine);
|
||||
SI_Error rc = Ini.LoadFile(lpFilePath);
|
||||
if (SI_SUCCESS(rc))
|
||||
{
|
||||
Ini.DeleteValue(lpSectionName, lpKeyName, lpValue, bRemoveEmpty);
|
||||
Ini.Delete(lpSectionName, lpKeyName, bRemoveEmpty);
|
||||
Ini.SetSpaces(s_bSetSpaces);
|
||||
rc = Ini.SaveFile(Globals.IniFile, true);
|
||||
}
|
||||
@ -604,7 +604,7 @@ void LoadSettings()
|
||||
Defaults.RenderingTechnology = IniSectionGetInt(Settings2_Section, L"SciDirectWriteTech", -111);
|
||||
if ((Defaults.RenderingTechnology != -111) && Settings.SaveSettings) {
|
||||
// cleanup
|
||||
IniSectionDeleteValue(Settings2_Section, L"SciDirectWriteTech", NULL, false);
|
||||
IniSectionDelete(Settings2_Section, L"SciDirectWriteTech", false);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
Defaults.RenderingTechnology = clampi(Defaults.RenderingTechnology, 0, 3);
|
||||
@ -613,7 +613,7 @@ void LoadSettings()
|
||||
Defaults.Bidirectional = IniSectionGetInt(Settings2_Section, L"EnableBidirectionalSupport", -111);
|
||||
if ((Defaults.Bidirectional != -111) && Settings.SaveSettings) {
|
||||
// cleanup
|
||||
IniSectionDeleteValue(Settings2_Section, L"EnableBidirectionalSupport", NULL, false);
|
||||
IniSectionDelete(Settings2_Section, L"EnableBidirectionalSupport", false);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
Defaults.Bidirectional = (clampi(Defaults.Bidirectional, SC_BIDIRECTIONAL_DISABLED, SC_BIDIRECTIONAL_R2L) > 0) ? SC_BIDIRECTIONAL_R2L : 0;
|
||||
@ -1143,7 +1143,7 @@ void LoadFlags()
|
||||
IniSectionSet##TYPE(Settings_Section, _W(_STRG(VARNAME)), Settings.VARNAME); \
|
||||
} \
|
||||
else { \
|
||||
IniSectionDeleteValue(Settings_Section, _W(_STRG(VARNAME)), NULL, false); \
|
||||
IniSectionDelete(Settings_Section, _W(_STRG(VARNAME)), false); \
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1302,7 +1302,7 @@ bool SaveSettings(bool bSaveSettingsNow)
|
||||
|
||||
Toolbar_GetButtons(Globals.hwndToolbar, IDT_FILE_NEW, Settings.ToolbarButtons, COUNTOF(Settings.ToolbarButtons));
|
||||
if (StringCchCompareX(Settings.ToolbarButtons, Defaults.ToolbarButtons) == 0) {
|
||||
IniSectionDeleteValue(Settings_Section, L"ToolbarButtons", NULL, false);
|
||||
IniSectionDelete(Settings_Section, L"ToolbarButtons", false);
|
||||
}
|
||||
else {
|
||||
IniSectionSetString(Settings_Section, L"ToolbarButtons", Settings.ToolbarButtons);
|
||||
|
||||
@ -69,12 +69,10 @@ inline bool IniSectionSetPos(LPCWSTR lpSectionName, LPCWSTR lpKeyName, DocPos po
|
||||
// a_pKey is NULL, the section to remove.
|
||||
// lpKeyName Key to remove from the section.Set to
|
||||
// NULL to remove the entire section.
|
||||
// lpValue Value of key to remove from the section.
|
||||
// Set to NULL to remove all keys.
|
||||
// bRemoveEmpty If the section is empty after this key has
|
||||
// been deleted, should the empty section be removed ?
|
||||
//
|
||||
bool IniSectionDeleteValue(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpValue, bool bRemoveEmpty);
|
||||
bool IniSectionDelete(LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bRemoveEmpty);
|
||||
bool IniSectionClear(LPCWSTR lpSectionName, bool bRemoveEmpty);
|
||||
bool IniClearAllSections(LPCWSTR lpPrefix, bool bRemoveEmpty);
|
||||
|
||||
@ -100,12 +98,10 @@ bool IniFileSetBool(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName
|
||||
// a_pKey is NULL, the section to remove.
|
||||
// lpKeyName Key to remove from the section.Set to
|
||||
// NULL to remove the entire section.
|
||||
// lpValue Value of key to remove from the section.
|
||||
// Set to NULL to remove all keys.
|
||||
// bRemoveEmpty If the section is empty after this key has
|
||||
// been deleted, should the empty section be removed ?
|
||||
//
|
||||
bool IniFileDeleteValue(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpValue, bool bRemoveEmpty);
|
||||
bool IniFileDelete(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bRemoveEmpty);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -2081,7 +2081,7 @@ bool SelectExternalToolBar(HWND hwnd)
|
||||
}
|
||||
else {
|
||||
StringCchCopy(s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), L"");
|
||||
IniFileDeleteValue(Globals.IniFile, L"Toolbar Images", L"BitmapHot", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Toolbar Images", L"BitmapHot", false);
|
||||
}
|
||||
|
||||
StringCchCopy(szFile, COUNTOF(szFile), s_tchToolbarBitmap);
|
||||
@ -2093,14 +2093,14 @@ bool SelectExternalToolBar(HWND hwnd)
|
||||
}
|
||||
else {
|
||||
StringCchCopy(s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), L"");
|
||||
IniFileDeleteValue(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", false);
|
||||
}
|
||||
s_iToolBarTheme = 2;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
IniFileDeleteValue(Globals.IniFile, L"Toolbar Images", L"BitmapHot", NULL, false);
|
||||
IniFileDeleteValue(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Toolbar Images", L"BitmapHot", false);
|
||||
IniFileDelete(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2143,7 +2143,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_BITMAP, s_tchToolbarBitmap,
|
||||
(bmp.bmHeight * NUMTOOLBITMAPS), bmp.bmHeight, NUMTOOLBITMAPS);
|
||||
StringCchCopy(s_tchToolbarBitmap, COUNTOF(s_tchToolbarBitmap), L"");
|
||||
IniSectionDeleteValue(L"Toolbar Images", L"BitmapDefault", NULL, false);
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapDefault", false);
|
||||
bDirtyFlag = true;
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
@ -2198,7 +2198,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_BITMAP, s_tchToolbarBitmapHot,
|
||||
(bmp.bmHeight * NUMTOOLBITMAPS), bmp.bmHeight, NUMTOOLBITMAPS);
|
||||
StringCchCopy(s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), L"");
|
||||
IniSectionDeleteValue(L"Toolbar Images", L"BitmapHot", NULL, false);
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapHot", false);
|
||||
bDirtyFlag = true;
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
@ -2246,7 +2246,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_BITMAP, s_tchToolbarBitmapDisabled,
|
||||
(bmp.bmHeight * NUMTOOLBITMAPS), bmp.bmHeight, NUMTOOLBITMAPS);
|
||||
StringCchCopy(s_tchToolbarBitmapDisabled, COUNTOF(s_tchToolbarBitmapDisabled), L"");
|
||||
IniSectionDeleteValue(L"Toolbar Images", L"BitmapDisabled", NULL, false);
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapDisabled", false);
|
||||
bDirtyFlag = true;
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
@ -5434,19 +5434,19 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
else { // clear entries
|
||||
|
||||
IniSectionDeleteValue(Window_Section, tchPosX, NULL, false);
|
||||
IniSectionDeleteValue(Window_Section, tchPosY, NULL, false);
|
||||
IniSectionDeleteValue(Window_Section, tchSizeX, NULL, false);
|
||||
IniSectionDeleteValue(Window_Section, tchSizeY, NULL, false);
|
||||
IniSectionDeleteValue(Window_Section, tchMaximized, NULL, false);
|
||||
IniSectionDeleteValue(Window_Section, tchZoom, NULL, false);
|
||||
IniSectionDelete(Window_Section, tchPosX, false);
|
||||
IniSectionDelete(Window_Section, tchPosY, false);
|
||||
IniSectionDelete(Window_Section, tchSizeX, false);
|
||||
IniSectionDelete(Window_Section, tchSizeY, false);
|
||||
IniSectionDelete(Window_Section, tchMaximized, false);
|
||||
IniSectionDelete(Window_Section, tchZoom, false);
|
||||
}
|
||||
|
||||
if (Flags.bStickyWindowPosition != DefaultFlags.bStickyWindowPosition) {
|
||||
IniSectionSetBool(L"Settings2", L"StickyWindowPosition", Flags.bStickyWindowPosition);
|
||||
}
|
||||
else {
|
||||
IniSectionDeleteValue(L"Settings2", L"StickyWindowPosition", NULL, false);
|
||||
IniSectionDelete(L"Settings2", L"StickyWindowPosition", false);
|
||||
}
|
||||
SaveIniFile(Globals.IniFile);
|
||||
}
|
||||
@ -5460,7 +5460,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
IniFileSetBool(Globals.IniFile, L"Settings2", L"ReuseWindow", Flags.bReuseWindow);
|
||||
}
|
||||
else {
|
||||
IniFileDeleteValue(Globals.IniFile, L"Settings2", L"ReuseWindow", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Settings2", L"ReuseWindow", false);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -5471,7 +5471,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
IniFileSetInt(Globals.IniFile, L"Settings2", L"SingleFileInstance", Flags.bSingleFileInstance);
|
||||
}
|
||||
else {
|
||||
IniFileDeleteValue(Globals.IniFile, L"Settings2", L"SingleFileInstance", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Settings2", L"SingleFileInstance", false);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -5584,7 +5584,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
if (IsCmdEnabled(hwnd, IDM_VIEW_SAVESETTINGS)) {
|
||||
Settings.SaveSettings = !Settings.SaveSettings;
|
||||
if (Settings.SaveSettings == Defaults.SaveSettings) {
|
||||
IniFileDeleteValue(Globals.IniFile, L"Settings", L"SaveSettings", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Settings", L"SaveSettings", false);
|
||||
}
|
||||
else {
|
||||
IniFileSetBool(Globals.IniFile, L"Settings", L"SaveSettings", Settings.SaveSettings);
|
||||
@ -6180,7 +6180,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case CMD_CLEARSAVEDWINPOS:
|
||||
s_DefWinInfo = InitDefaultWndPos(2);
|
||||
IniFileDeleteValue(Globals.IniFile, L"Settings2", L"DefaultWindowPosition", NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Settings2", L"DefaultWindowPosition", false);
|
||||
break;
|
||||
|
||||
case CMD_OPENINIFILE:
|
||||
|
||||
@ -43,7 +43,7 @@ SCLEX_NULL, IDS_LEX_STR_63266, L"2nd Default Text", L"", L"",
|
||||
/* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_2ND_LONG_LN, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_2ND_X_SPC, L"2nd Extra Line Spacing (Size)", L"", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"size:+2; fore:#000000; back:#00DC00; charset:2; case:U; alpha:100", L"" },
|
||||
/* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0000FF; indic_box", L"" },
|
||||
/* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0000FF; alpha:60; alpha2:60; indic_box", L"" },
|
||||
/* 14 */ { {_STYLE_GETSTYLEID(STY_URL_HOTSPOT)}, IDS_LEX_STR_63265, L"2nd Hyperlink Hotspots", L"fore:#00D000; back:#009C00; alpha:180; indic_compositionthin", L"" },
|
||||
/* 15 */ { {_STYLE_GETSTYLEID(STY_MULTI_EDIT)}, IDS_LEX_STR_63355, L"Multi Edit Indicator", L"fore:#00A5FF; indic_box", L"" },
|
||||
/* 16 */ { {_STYLE_GETSTYLEID(STY_IME_COLOR)}, IDS_LEX_STR_63353, L"2nd Inline-IME Color", L"fore:#FF0000", L"" },
|
||||
|
||||
27
src/Styles.c
27
src/Styles.c
@ -639,7 +639,7 @@ void Style_Save()
|
||||
IniFileSetString(Globals.IniFile, L"Styles", STYLING_THEME_NAME, Theme_Files[s_idxSelectedTheme].szName);
|
||||
}
|
||||
else {
|
||||
IniFileDeleteValue(Globals.IniFile, L"Styles", STYLING_THEME_NAME, NULL, false);
|
||||
IniFileDelete(Globals.IniFile, L"Styles", STYLING_THEME_NAME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -719,22 +719,39 @@ bool Style_ExportToFile(const WCHAR* szFile, bool bForceAll)
|
||||
if (bUse2ndSty) {
|
||||
IniSectionSetBool(Styles_Section, L"Use2ndDefaultStyle", bUse2ndSty);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Styles_Section, L"Use2ndDefaultStyle", false);
|
||||
}
|
||||
|
||||
// default scheme
|
||||
if (s_iDefaultLexer != 0) {
|
||||
IniSectionSetInt(Styles_Section, L"DefaultScheme", s_iDefaultLexer);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Styles_Section, L"DefaultScheme", false);
|
||||
}
|
||||
|
||||
// auto select
|
||||
if (!s_bAutoSelect) {
|
||||
IniSectionSetInt(Styles_Section, L"AutoSelect", s_bAutoSelect);
|
||||
IniSectionSetBool(Styles_Section, L"AutoSelect", s_bAutoSelect);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Styles_Section, L"AutoSelect", false);
|
||||
}
|
||||
|
||||
// scheme select dlg dimensions
|
||||
if (s_cxStyleSelectDlg != STYLESELECTDLG_X) {
|
||||
IniSectionSetInt(Styles_Section, L"SelectDlgSizeX", s_cxStyleSelectDlg);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Styles_Section, L"SelectDlgSizeX", false);
|
||||
}
|
||||
if (s_cyStyleSelectDlg != STYLESELECTDLG_Y) {
|
||||
IniSectionSetInt(Styles_Section, L"SelectDlgSizeY", s_cyStyleSelectDlg);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Styles_Section, L"SelectDlgSizeY", false);
|
||||
}
|
||||
|
||||
// create canonical order of lexer sections
|
||||
if (bForceAll) {
|
||||
@ -758,6 +775,9 @@ bool Style_ExportToFile(const WCHAR* szFile, bool bForceAll)
|
||||
{
|
||||
IniSectionSetString(Lexer_Section, L"FileNameExtensions", g_pLexArray[iLexer]->szExtensions);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Lexer_Section, L"FileNameExtensions", false);
|
||||
}
|
||||
|
||||
unsigned i = 0;
|
||||
while (g_pLexArray[iLexer]->Styles[i].iStyle != -1)
|
||||
@ -773,6 +793,9 @@ bool Style_ExportToFile(const WCHAR* szFile, bool bForceAll)
|
||||
Style_CopyStyles_IfNotDefined(g_pLexArray[iLexer]->Styles[i].szValue, szTmpStyle, COUNTOF(szTmpStyle), true, true);
|
||||
IniSectionSetString(Lexer_Section, g_pLexArray[iLexer]->Styles[i].pszName, szTmpStyle);
|
||||
}
|
||||
else {
|
||||
IniSectionDelete(Lexer_Section, g_pLexArray[iLexer]->Styles[i].pszName, false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 704
|
||||
#define VERSION_BUILD 2384
|
||||
#define VERSION_REV 706
|
||||
#define VERSION_BUILD 2385
|
||||
#define SCINTILLA_VER 417
|
||||
#define ONIGURUMA_REGEX_VER 6.9.2
|
||||
#define VERSION_PATCH Oniguruma
|
||||
#define VERSION_PATCH DEV
|
||||
|
||||
Loading…
Reference in New Issue
Block a user