mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ fix: 1st bugfix session for new SimpleIni config reader.
This commit is contained in:
parent
9eae363c16
commit
b8d9a5bc93
File diff suppressed because it is too large
Load Diff
@ -25,8 +25,17 @@ extern "C" {
|
||||
|
||||
//==== Ini-File Handling =============================================
|
||||
|
||||
bool FindIniFile();
|
||||
int TestIniFile();
|
||||
bool CreateIniFile();
|
||||
bool CreateIniFileEx(LPCWSTR lpszIniFile);
|
||||
void LoadSettings();
|
||||
void SaveSettings(bool);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool LoadIniFile(LPCWSTR lpIniFilePath);
|
||||
bool SaveIniFile();
|
||||
bool SaveIniFile(LPCWSTR lpIniFilePath);
|
||||
void ReleaseIniFile();
|
||||
|
||||
size_t IniSectionGetString(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault,
|
||||
|
||||
@ -1272,14 +1272,6 @@ private:
|
||||
*/
|
||||
size_t m_uDataLen;
|
||||
|
||||
/** File path for this data */
|
||||
char m_FilePathA[MAX_PATH];
|
||||
|
||||
#ifdef SI_HAS_WIDE_FILE
|
||||
SI_WCHAR_T m_FilePathW[MAX_PATH];
|
||||
#endif
|
||||
|
||||
|
||||
/** File comment for this data, if one exists. */
|
||||
const SI_CHAR * m_pFileComment;
|
||||
|
||||
@ -1344,10 +1336,6 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Reset()
|
||||
delete[] m_pData;
|
||||
m_pData = NULL;
|
||||
m_uDataLen = 0;
|
||||
m_FilePathA[0] = '\0';
|
||||
#ifdef SI_HAS_WIDE_FILE
|
||||
m_FilePathW[0] = L'\0';
|
||||
#endif
|
||||
m_pFileComment = NULL;
|
||||
if (!m_data.empty()) {
|
||||
m_data.erase(m_data.begin(), m_data.end());
|
||||
@ -1392,7 +1380,6 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::LoadFile(
|
||||
)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wcscpy_s(m_FilePathW, _countof(m_FilePathW), a_pwszFile);
|
||||
FILE * fp = NULL;
|
||||
#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
|
||||
_wfopen_s(&fp, a_pwszFile, L"rb");
|
||||
@ -1565,16 +1552,6 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::LoadData(
|
||||
m_pData = pData;
|
||||
m_uDataLen = uLen+1;
|
||||
}
|
||||
|
||||
// Notepad3: change .ini-file encoding to UTF-8
|
||||
if (pDataUTF16toUTF8) {
|
||||
#ifdef SI_HAS_WIDE_FILE
|
||||
SaveFile(m_FilePathW, true);
|
||||
#else
|
||||
SaveFile(m_FilePathA, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
return SI_OK;
|
||||
}
|
||||
|
||||
@ -2529,17 +2506,17 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Save(
|
||||
if (iSection->pComment) {
|
||||
if (bNeedNewLine) {
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
//§§§a_oOutput.Write(SI_NEWLINE_A);
|
||||
bNeedNewLine = false;
|
||||
}
|
||||
if (!OutputMultiLineText(a_oOutput, convert, iSection->pComment)) {
|
||||
return SI_FAIL;
|
||||
}
|
||||
bNeedNewLine = false;
|
||||
}
|
||||
|
||||
if (bNeedNewLine) {
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
//§§§a_oOutput.Write(SI_NEWLINE_A);
|
||||
bNeedNewLine = false;
|
||||
}
|
||||
|
||||
@ -2548,10 +2525,12 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Save(
|
||||
if (!convert.ConvertToStore(iSection->pItem)) {
|
||||
return SI_FAIL;
|
||||
}
|
||||
//a_oOutput.Write(SI_NEWLINE_A); // before new section
|
||||
a_oOutput.Write("[");
|
||||
a_oOutput.Write(convert.Data());
|
||||
a_oOutput.Write("]");
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
bNeedNewLine = false;
|
||||
}
|
||||
|
||||
// get all of the keys sorted in load order
|
||||
@ -2577,6 +2556,7 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Save(
|
||||
// write out the comment if there is one
|
||||
if (iValue->pComment) {
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
bNeedNewLine = false;
|
||||
if (!OutputMultiLineText(a_oOutput, convert, iValue->pComment)) {
|
||||
return SI_FAIL;
|
||||
}
|
||||
@ -2597,6 +2577,7 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Save(
|
||||
// multi-line data needs to be processed specially to ensure
|
||||
// that we use the correct newline format for the current system
|
||||
a_oOutput.Write("<<<END_OF_TEXT" SI_NEWLINE_A);
|
||||
bNeedNewLine = false;
|
||||
if (!OutputMultiLineText(a_oOutput, convert, iValue->pItem)) {
|
||||
return SI_FAIL;
|
||||
}
|
||||
@ -2606,9 +2587,10 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Save(
|
||||
a_oOutput.Write(convert.Data());
|
||||
}
|
||||
a_oOutput.Write(SI_NEWLINE_A);
|
||||
bNeedNewLine = false;
|
||||
}
|
||||
}
|
||||
bNeedNewLine = true;
|
||||
//§§§bNeedNewLine = true;
|
||||
}
|
||||
|
||||
return SI_OK;
|
||||
|
||||
@ -3968,7 +3968,7 @@ bool StatusSetTextID(HWND hwnd, UINT nPart, UINT uID)
|
||||
//
|
||||
// Toolbar_Get/SetButtons()
|
||||
//
|
||||
int Toolbar_GetButtons(HWND hwnd, int cmdBase, LPWSTR lpszButtons, int cchButtons)
|
||||
int Toolbar_GetButtons(HANDLE hwnd, int cmdBase, LPWSTR lpszButtons, int cchButtons)
|
||||
{
|
||||
WCHAR tchButtons[512] = { L'\0' };
|
||||
WCHAR tchItem[32] = { L'\0' };
|
||||
@ -3988,7 +3988,7 @@ int Toolbar_GetButtons(HWND hwnd, int cmdBase, LPWSTR lpszButtons, int cchButton
|
||||
return(c);
|
||||
}
|
||||
|
||||
int Toolbar_SetButtons(HWND hwnd, int cmdBase, LPCWSTR lpszButtons, LPCTBBUTTON ptbb, int ctbb)
|
||||
int Toolbar_SetButtons(HANDLE hwnd, int cmdBase, LPCWSTR lpszButtons, LPCTBBUTTON ptbb, int ctbb)
|
||||
{
|
||||
WCHAR tchButtons[MIDSZ_BUFFER];
|
||||
|
||||
|
||||
@ -99,8 +99,8 @@ void DeleteBitmapButton(HWND hwnd, int nCtlId);
|
||||
void StatusSetText(HWND hwnd, UINT nPart, LPCWSTR lpszText);
|
||||
bool StatusSetTextID(HWND hwnd, UINT nPart, UINT uID);
|
||||
|
||||
int Toolbar_GetButtons(HWND hwnd, int cmdBase, LPWSTR lpszButtons, int cchButtons);
|
||||
int Toolbar_SetButtons(HWND, int, LPCWSTR, void*, int);
|
||||
int Toolbar_GetButtons(HANDLE hwnd, int cmdBase, LPWSTR lpszButtons, int cchButtons);
|
||||
int Toolbar_SetButtons(HANDLE, int, LPCWSTR, void*, int);
|
||||
|
||||
LRESULT SendWMSize(HWND hwnd, RECT* rc);
|
||||
|
||||
|
||||
@ -1605,7 +1605,7 @@ bool MRU_Save(LPMRULIST pmru)
|
||||
}
|
||||
}
|
||||
|
||||
SaveIniFile();
|
||||
SaveIniFile(Globals.IniFile);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
1055
src/Notepad3.c
1055
src/Notepad3.c
File diff suppressed because it is too large
Load Diff
@ -117,6 +117,8 @@ typedef enum {
|
||||
//==== Function Declarations ==================================================
|
||||
bool InitApplication(HINSTANCE hInstance);
|
||||
HWND InitInstance(HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow);
|
||||
WININFO InitDefaultWndPos(const int flagsPos);
|
||||
void InitWindowPosition(WININFO* pWinInfo, const int flagsPos);
|
||||
void BeginWaitCursor(LPCWSTR text);
|
||||
void EndWaitCursor();
|
||||
bool ActivatePrevInst();
|
||||
@ -130,15 +132,9 @@ void InstallFileWatching(LPCWSTR lpszFile);
|
||||
void CALLBACK WatchTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
|
||||
void CALLBACK PasteBoardTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
|
||||
|
||||
|
||||
void LoadSettings();
|
||||
void SaveSettings(bool);
|
||||
void ParseCommandLine();
|
||||
void LoadFlags();
|
||||
bool FindIniFile();
|
||||
int TestIniFile();
|
||||
bool CreateIniFile();
|
||||
bool CreateIniFileEx(LPCWSTR lpszIniFile);
|
||||
void SaveAllSettings(bool bSaveSettingsNow);
|
||||
void ShowZoomCallTip();
|
||||
void CancelCallTip();
|
||||
|
||||
|
||||
@ -769,7 +769,7 @@ bool Style_ExportToFile(const WCHAR* szFile, bool bForceAll)
|
||||
}
|
||||
}
|
||||
|
||||
SaveIniFile();
|
||||
SaveIniFile(szFile);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ typedef struct _settings2_t
|
||||
} SETTINGS2_T, *PSETTINGS2_T;
|
||||
|
||||
extern SETTINGS2_T Settings2;
|
||||
//extern SETTINGS2_T Defaults2;
|
||||
extern SETTINGS2_T Defaults2;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user