mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
commit
f67c10df48
@ -274,7 +274,7 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
|
||||
INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMsg, ...)
|
||||
{
|
||||
int const iMode = StrIsEmpty(lpstrSetting) ? 0 : IniGetInt(L"Suppressed Messages", lpstrSetting, 0);
|
||||
if (iMode) { return iMode; }
|
||||
if (iMode > 0) { return iMode; }
|
||||
|
||||
WCHAR wchMessage[LARGE_BUFFER];
|
||||
if (!GetLngString(uidMsg, wchMessage, COUNTOF(wchMessage))) { return -1LL; }
|
||||
@ -315,7 +315,7 @@ INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMsg, ...)
|
||||
}
|
||||
|
||||
msgBox.lpstrSetting = (LPWSTR)lpstrSetting;
|
||||
msgBox.bDisableCheckBox = (StrIsEmpty(Globals.IniFile) || StrIsEmpty(lpstrSetting)) ? true : false;
|
||||
msgBox.bDisableCheckBox = (StrIsEmpty(Globals.IniFile) || StrIsEmpty(lpstrSetting) || (iMode < 0)) ? true : false;
|
||||
|
||||
|
||||
int idDlg;
|
||||
@ -1908,10 +1908,11 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
|
||||
}
|
||||
|
||||
// Ask...
|
||||
int answ = (LOWORD(wParam) == IDOK) ? (int)InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_MRUDLG)
|
||||
: ((iCur == lvi.iItem) ? IDNO : IDYES);
|
||||
INT_PTR const answer = (LOWORD(wParam) == IDOK) ?
|
||||
InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_MRUDLG)
|
||||
: ((iCur == lvi.iItem) ? IDNO : IDYES);
|
||||
|
||||
if (IDYES == answ) {
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
|
||||
MRU_Delete(Globals.pFileMRU,lvi.iItem);
|
||||
MRU_DeleteFileFromStore(Globals.pFileMRU,tchFileName);
|
||||
@ -3426,7 +3427,8 @@ void DialogAdminExe(HWND hwnd, bool bExecInstaller)
|
||||
ShellExecuteEx(&sei);
|
||||
if ((INT_PTR)sei.hInstApp < 32)
|
||||
{
|
||||
if (IDOK == InfoBoxLng(MB_OKCANCEL, L"NoAdminTool", IDS_MUI_ERR_ADMINEXE))
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"NoAdminTool", IDS_MUI_ERR_ADMINEXE);
|
||||
if ((IDOK == answer) || (IDYES == answer))
|
||||
{
|
||||
sei.lpFile = VERSION_UPDATE_CHECK;
|
||||
ShellExecuteEx(&sei);
|
||||
|
||||
69
src/Edit.c
69
src/Edit.c
@ -451,20 +451,23 @@ bool EditSetNewEncoding(HWND hwnd, cpi_enc_t iNewEncoding, bool bNoUI, bool bSet
|
||||
|
||||
if (SciCall_GetTextLength() <= 0) {
|
||||
|
||||
bool bIsEmptyUndoHistory = !(SciCall_CanUndo() || SciCall_CanRedo());
|
||||
bool const bIsEmptyUndoHistory = !(SciCall_CanUndo() || SciCall_CanRedo());
|
||||
|
||||
|
||||
bool doNewEncoding = (!bIsEmptyUndoHistory && !bNoUI) ?
|
||||
(InfoBoxLng(MB_YESNO, L"MsgConv2", IDS_MUI_ASK_ENCODING2) == IDYES) : true;
|
||||
|
||||
bool doNewEncoding = true;
|
||||
if (!bIsEmptyUndoHistory && !bNoUI) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO, L"MsgConv2", IDS_MUI_ASK_ENCODING2);
|
||||
doNewEncoding = ((IDOK == answer) || (IDYES == answer));
|
||||
}
|
||||
if (doNewEncoding) {
|
||||
return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,bSetSavePoint);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
bool doNewEncoding = (!bNoUI) ? (InfoBoxLng(MB_YESNO, L"MsgConv1", IDS_MUI_ASK_ENCODING) == IDYES) : true;
|
||||
|
||||
bool doNewEncoding = true;
|
||||
if (!bNoUI) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO, L"MsgConv1", IDS_MUI_ASK_ENCODING);
|
||||
doNewEncoding = ((IDOK == answer) || (IDYES == answer));
|
||||
}
|
||||
if (doNewEncoding) {
|
||||
return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,false);
|
||||
}
|
||||
@ -971,7 +974,7 @@ bool EditLoadFile(
|
||||
{
|
||||
status->bUnicodeErr = false;
|
||||
status->bFileTooBig = false;
|
||||
status->bUnknownExt = false;
|
||||
status->bUnknownExt = true;
|
||||
|
||||
HANDLE hFile = CreateFile(pszFile,
|
||||
GENERIC_READ,
|
||||
@ -996,19 +999,23 @@ bool EditLoadFile(
|
||||
// check for unknown extension
|
||||
LPCWSTR lpszExt = PathFindExtension(pszFile);
|
||||
if (lpszExt && !Style_HasLexerForExt(lpszExt)) {
|
||||
if (InfoBoxLng(MB_YESNO, L"MsgFileUnknownExt", IDS_MUI_WARN_UNKNOWN_EXT, lpszExt) != IDYES) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO, L"MsgFileUnknownExt", IDS_MUI_WARN_UNKNOWN_EXT, lpszExt);
|
||||
if (!((IDOK == answer) || (IDYES == answer))) {
|
||||
CloseHandle(hFile);
|
||||
status->bUnknownExt = true;
|
||||
Encoding_SrcCmdLn(CPI_NONE);
|
||||
Encoding_SrcWeak(CPI_NONE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
status->bUnknownExt = false;
|
||||
}
|
||||
|
||||
// Check if a warning message should be displayed for large files
|
||||
DWORD dwFileSizeLimit = Settings2.FileLoadWarningMB;
|
||||
if ((dwFileSizeLimit != 0) && ((dwFileSizeLimit * 1024 * 1024) < dwFileSize)) {
|
||||
if (InfoBoxLng(MB_YESNO, L"MsgFileSizeWarning", IDS_MUI_WARN_LOAD_BIG_FILE) != IDYES) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO, L"MsgFileSizeWarning", IDS_MUI_WARN_LOAD_BIG_FILE);
|
||||
if (!((IDOK == answer) || (IDYES == answer))) {
|
||||
CloseHandle(hFile);
|
||||
status->bFileTooBig = true;
|
||||
Encoding_SrcCmdLn(CPI_NONE);
|
||||
@ -1038,7 +1045,8 @@ bool EditLoadFile(
|
||||
// ((readFlag == DECRYPT_SUCCESS) || (readFlag & DECRYPT_NO_ENCRYPTION)) => true;
|
||||
if ((readFlag & DECRYPT_CANCELED_NO_PASS) || (readFlag & DECRYPT_WRONG_PASS))
|
||||
{
|
||||
bReadSuccess = (InfoBoxLng(MB_OKCANCEL, L"MsgNoOrWrongPassphrase", IDS_MUI_NOPASS) == IDOK);
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"MsgNoOrWrongPassphrase", IDS_MUI_NOPASS);
|
||||
bReadSuccess = ((IDOK == answer) || (IDYES == answer));
|
||||
if (!bReadSuccess) {
|
||||
FreeMem(lpData);
|
||||
return true;
|
||||
@ -1462,7 +1470,12 @@ bool EditSaveFile(
|
||||
}
|
||||
FreeMem(lpDataWide);
|
||||
|
||||
if (!bCancelDataLoss || InfoBoxLng(MB_OKCANCEL,L"MsgConv3",IDS_MUI_ERR_UNICODE2) == IDOK) {
|
||||
if (bCancelDataLoss) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"MsgConv3", IDS_MUI_ERR_UNICODE2);
|
||||
bCancelDataLoss = !((IDOK == answer) || (IDYES == answer));
|
||||
}
|
||||
|
||||
if (!bCancelDataLoss) {
|
||||
SetEndOfFile(hFile);
|
||||
bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten);
|
||||
Globals.dwLastError = GetLastError();
|
||||
@ -1547,8 +1560,9 @@ void EditInvertCase(HWND hwnd)
|
||||
FreeMem(pszText);
|
||||
FreeMem(pszTextW);
|
||||
}
|
||||
else
|
||||
InfoBoxLng(MB_ICONWARNING, NULL,IDS_MUI_SELRECT);
|
||||
else {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_SELRECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1609,8 +1623,9 @@ void EditTitleCase(HWND hwnd)
|
||||
FreeMem(pszText);
|
||||
FreeMem(pszTextW);
|
||||
}
|
||||
else
|
||||
else {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_SELRECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4463,7 +4478,7 @@ void EditEnsureSelectionVisible(HWND hwnd)
|
||||
//
|
||||
void EditEnsureConsistentLineEndings(HWND hwnd)
|
||||
{
|
||||
Globals.bInconsistentLineBreaks = false;
|
||||
Globals.bDocHasInconsistentEOLs = false;
|
||||
SciCall_ConvertEOLs(SciCall_GetEOLMode());
|
||||
EditFixPositions(hwnd);
|
||||
}
|
||||
@ -5983,7 +5998,8 @@ bool EditFindNext(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bo
|
||||
DocPos end = iDocEndPos;
|
||||
|
||||
if (start >= end) {
|
||||
if (IDOK == InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap1", IDS_MUI_FIND_WRAPFW)) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap1", IDS_MUI_FIND_WRAPFW);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
end = min_p(start, iDocEndPos); start = 0;
|
||||
}
|
||||
else
|
||||
@ -6002,7 +6018,10 @@ bool EditFindNext(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bo
|
||||
{
|
||||
UpdateStatusbar(false);
|
||||
if (!lpefr->bNoFindWrap && !bSuppressNotFound) {
|
||||
if (IDOK == InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap2", IDS_MUI_FIND_WRAPFW)) {
|
||||
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap2", IDS_MUI_FIND_WRAPFW);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
|
||||
end = min_p(start, iDocEndPos); start = 0;
|
||||
|
||||
iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_WRAPED);
|
||||
@ -6062,11 +6081,13 @@ bool EditFindPrev(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bo
|
||||
DocPos end = 0;
|
||||
|
||||
if (start <= end) {
|
||||
if (IDOK == InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap1", IDS_MUI_FIND_WRAPFW)) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap1", IDS_MUI_FIND_WRAPFW);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
end = start; start = iTextLength;
|
||||
}
|
||||
else
|
||||
else {
|
||||
bSuppressNotFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
CancelCallTip();
|
||||
@ -6083,7 +6104,9 @@ bool EditFindPrev(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bo
|
||||
UpdateStatusbar(false);
|
||||
if (!lpefr->bNoFindWrap && !bSuppressNotFound)
|
||||
{
|
||||
if (IDOK == InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap2", IDS_MUI_FIND_WRAPRE)) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_OKCANCEL, L"MsgFindWrap2", IDS_MUI_FIND_WRAPRE);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
|
||||
end = start; start = iTextLength;
|
||||
|
||||
iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_WRAPED);
|
||||
|
||||
113
src/Notepad3.c
113
src/Notepad3.c
@ -488,7 +488,7 @@ static void _InitGlobals()
|
||||
Globals.bFindReplCopySelOrClip = true;
|
||||
Globals.bReplaceInitialized = false;
|
||||
Globals.FindReplaceMatchFoundState = FND_NOP;
|
||||
Globals.bInconsistentLineBreaks = false;
|
||||
Globals.bDocHasInconsistentEOLs = false;
|
||||
|
||||
Flags.bDevDebugMode = DefaultFlags.bDevDebugMode = false;
|
||||
Flags.bStickyWindowPosition = DefaultFlags.bStickyWindowPosition = false;
|
||||
@ -2473,9 +2473,9 @@ LRESULT MsgDropFiles(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
// delegated to SCN_URIDROPPED
|
||||
}
|
||||
|
||||
if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1)
|
||||
if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_DROP);
|
||||
|
||||
}
|
||||
DragFinish(hDrop);
|
||||
|
||||
return FALSE;
|
||||
@ -2512,9 +2512,9 @@ static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyS
|
||||
else
|
||||
FileLoad(false, false, false, Settings.SkipUnicodeDetection, Settings.SkipANSICodePageDetection, false, szBuf);
|
||||
|
||||
if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1)
|
||||
if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_DROP);
|
||||
|
||||
}
|
||||
dwEffect = DROPEFFECT_COPY;
|
||||
}
|
||||
|
||||
@ -2707,11 +2707,16 @@ LRESULT MsgChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (PathFileExists(Globals.CurrentFile))
|
||||
{
|
||||
if ((FileWatching.FileWatchingMode == 2 && !IsSaveNeeded(ISN_GET)) ||
|
||||
InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_FILECHANGENOTIFY) == IDYES)
|
||||
bool bRevertFile = (FileWatching.FileWatchingMode == 2 && !IsSaveNeeded(ISN_GET));
|
||||
|
||||
if (!bRevertFile) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_FILECHANGENOTIFY);
|
||||
bRevertFile = ((IDOK == answer) || (IDYES == answer));
|
||||
}
|
||||
|
||||
if (bRevertFile)
|
||||
{
|
||||
FileRevert(Globals.CurrentFile, Encoding_HasChanged(CPI_GET));
|
||||
|
||||
if (FileWatching.ChasingDocTail)
|
||||
{
|
||||
SciCall_SetReadOnly(FileWatching.ChasingDocTail);
|
||||
@ -2721,7 +2726,8 @@ LRESULT MsgChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_FILECHANGENOTIFY2) == IDYES) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_FILECHANGENOTIFY2);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
FileSave(true, false, false, false);
|
||||
}
|
||||
}
|
||||
@ -3273,8 +3279,11 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
|
||||
case IDM_FILE_REVERT:
|
||||
if (IsSaveNeeded(ISN_GET) && InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_REVERT) != IDYES) {
|
||||
break;
|
||||
if (IsSaveNeeded(ISN_GET)) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_REVERT);
|
||||
if (!((IDOK == answer) || (IDYES == answer))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
FileRevert(Globals.CurrentFile, Encoding_HasChanged(CPI_GET));
|
||||
break;
|
||||
@ -3304,8 +3313,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
dwFileAttributes = (dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
|
||||
else
|
||||
dwFileAttributes |= FILE_ATTRIBUTE_READONLY;
|
||||
if (!SetFileAttributes(Globals.CurrentFile,dwFileAttributes))
|
||||
InfoBoxLng(MB_ICONWARNING, NULL,IDS_MUI_READONLY_MODIFY,Globals.CurrentFile);
|
||||
if (!SetFileAttributes(Globals.CurrentFile, dwFileAttributes)) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_READONLY_MODIFY, Globals.CurrentFile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_READONLY_MODIFY, Globals.CurrentFile);
|
||||
@ -3417,8 +3427,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
GetLngString(IDS_MUI_PRINT_PAGENUM,tchPageFmt,COUNTOF(tchPageFmt));
|
||||
|
||||
if (!EditPrint(Globals.hwndEdit,pszTitle,tchPageFmt))
|
||||
InfoBoxLng(MB_ICONWARNING, NULL,IDS_MUI_PRINT_ERROR,pszTitle);
|
||||
if (!EditPrint(Globals.hwndEdit, pszTitle, tchPageFmt)) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_PRINT_ERROR, pszTitle);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3442,11 +3453,12 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_FILE_CREATELINK:
|
||||
{
|
||||
if (!StringCchLenW(Globals.CurrentFile,COUNTOF(Globals.CurrentFile)))
|
||||
if (!StringCchLenW(Globals.CurrentFile, COUNTOF(Globals.CurrentFile))) {
|
||||
break;
|
||||
|
||||
if (!PathCreateDeskLnk(Globals.CurrentFile))
|
||||
InfoBoxLng(MB_ICONWARNING, NULL,IDS_MUI_ERR_CREATELINK);
|
||||
}
|
||||
if (!PathCreateDeskLnk(Globals.CurrentFile)) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_CREATELINK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3571,9 +3583,13 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
cpi_enc_t iNewEncoding = Encoding_MapUnicode(Encoding_Current(CPI_GET));
|
||||
|
||||
if (IsSaveNeeded(ISN_GET) && InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_RECODE) != IDYES) {
|
||||
break;
|
||||
if (IsSaveNeeded(ISN_GET)) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_RECODE);
|
||||
if (!((IDOK == answer) || (IDYES == answer))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (RecodeDlg(hwnd,&iNewEncoding))
|
||||
{
|
||||
StringCchCopy(tchMaxPathBuffer,COUNTOF(tchMaxPathBuffer),Globals.CurrentFile);
|
||||
@ -7423,11 +7439,6 @@ void LoadSettings()
|
||||
|
||||
// Scintilla Styles
|
||||
Style_Load();
|
||||
|
||||
// finally clear [Suppressed Messages] (old InfoBox() version)
|
||||
if (s_iSettingsVersion < CFG_VER_0002) {
|
||||
IniClearSection(L"Suppressed Messages", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9043,16 +9054,16 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
static WCHAR tchEOL[16] = { L'\0' };
|
||||
if (_eol_mode == SC_EOL_LF)
|
||||
{
|
||||
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bInconsistentLineBreaks ? _LFi_f : _LF_f),
|
||||
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bDocHasInconsistentEOLs ? _LFi_f : _LF_f),
|
||||
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
|
||||
}
|
||||
else if (_eol_mode == SC_EOL_CR)
|
||||
{
|
||||
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bInconsistentLineBreaks ? _CRi_f : _CR_f),
|
||||
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bDocHasInconsistentEOLs ? _CRi_f : _CR_f),
|
||||
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
|
||||
}
|
||||
else {
|
||||
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bInconsistentLineBreaks ? _CRLFi_f : _CRLF_f),
|
||||
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bDocHasInconsistentEOLs ? _CRLFi_f : _CRLF_f),
|
||||
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
|
||||
}
|
||||
s_iEOLMode = _eol_mode;
|
||||
@ -9687,7 +9698,14 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
|
||||
// Ask to create a new file...
|
||||
if (!bReload && !PathFileExists(szFileName))
|
||||
{
|
||||
if (s_flagQuietCreate || InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_CREATE, szFileName) == IDYES) {
|
||||
bool bCreateFile = s_flagQuietCreate;
|
||||
if (!bCreateFile) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_CREATE, szFileName);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
bCreateFile = true;
|
||||
}
|
||||
}
|
||||
if (bCreateFile) {
|
||||
HANDLE hFile = CreateFile(szFileName,
|
||||
GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||
@ -9810,28 +9828,38 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
|
||||
}
|
||||
|
||||
// Show inconsistent line endings warning
|
||||
Globals.bInconsistentLineBreaks = fioStatus.bInconsistentEOLs;
|
||||
Globals.bDocHasInconsistentEOLs = fioStatus.bInconsistentEOLs;
|
||||
_UpdateStatusbarDelayed(true);
|
||||
|
||||
if (Globals.bInconsistentLineBreaks && Settings.WarnInconsistEOLs && !s_flagPrintFileAndLeave)
|
||||
{
|
||||
|
||||
bool const bCheckEOL = Globals.bDocHasInconsistentEOLs && Settings.WarnInconsistEOLs
|
||||
&& !s_flagPrintFileAndLeave
|
||||
&& !fioStatus.bUnknownExt
|
||||
&& !bReload;
|
||||
|
||||
if (bCheckEOL) {
|
||||
if (WarnLineEndingDlg(Globals.hwndMain, &fioStatus)) {
|
||||
SciCall_ConvertEOLs(fioStatus.iEOLMode);
|
||||
Globals.bInconsistentLineBreaks = false;
|
||||
Globals.bDocHasInconsistentEOLs = false;
|
||||
}
|
||||
SciCall_SetEOLMode(fioStatus.iEOLMode);
|
||||
_UpdateStatusbarDelayed(true);
|
||||
}
|
||||
|
||||
// Show inconsistent indentation
|
||||
|
||||
fioStatus.iGlobalIndent = I_MIX_LN; // init
|
||||
|
||||
if (Settings.WarnInconsistentIndents && !s_flagPrintFileAndLeave)
|
||||
bool const bCheckIndent = Settings.WarnInconsistentIndents
|
||||
&& !s_flagPrintFileAndLeave
|
||||
&& !fioStatus.bUnknownExt
|
||||
&& !bReload;
|
||||
|
||||
if (bCheckIndent)
|
||||
{
|
||||
EditIndentationStatistic(Globals.hwndEdit, &fioStatus);
|
||||
ConsistentIndentationCheck(&fioStatus);
|
||||
}
|
||||
|
||||
if (Settings.AutoDetectIndentSettings && !s_flagPrintFileAndLeave)
|
||||
{
|
||||
if (!Settings.WarnInconsistentIndents || (fioStatus.iGlobalIndent != I_MIX_LN))
|
||||
@ -10060,7 +10088,8 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy)
|
||||
s_bFileReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY);
|
||||
if (s_bFileReadOnly) {
|
||||
UpdateToolbar();
|
||||
if (InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_READONLY_SAVE, Globals.CurrentFile) == IDYES) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_READONLY_SAVE, Globals.CurrentFile);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
bSaveAs = true;
|
||||
}
|
||||
else {
|
||||
@ -10141,8 +10170,8 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy)
|
||||
{
|
||||
if (!s_bIsElevated && (Globals.dwLastError == ERROR_ACCESS_DENIED))
|
||||
{
|
||||
if (IDYES == InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_ACCESSDENIED, Globals.CurrentFile))
|
||||
{
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_ACCESSDENIED, Globals.CurrentFile);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
if (DoElevatedRelaunch(&fioStatus))
|
||||
{
|
||||
PostMessage(Globals.hwndMain, WM_CLOSE, 0, 0);
|
||||
@ -10395,7 +10424,8 @@ bool ActivatePrevInst()
|
||||
return true;
|
||||
}
|
||||
// IsWindowEnabled()
|
||||
if (IDYES == InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_PREVWINDISABLED)) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_PREVWINDISABLED);
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -10479,7 +10509,8 @@ bool ActivatePrevInst()
|
||||
return true;
|
||||
}
|
||||
// IsWindowEnabled()
|
||||
return ((IDYES == InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_PREVWINDISABLED)) ? false : true);
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_PREVWINDISABLED);
|
||||
return ((IDOK == answer) || (IDYES == answer)) ? false : true;;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ SCLEX_NULL, IDS_LEX_DEF_TXT, L"Default Text", L"txt; text; tmp; log; asc; doc; w
|
||||
/* 6 */ { {_STYLE_GETSTYLEID(STY_SEL_TXT)}, IDS_LEX_STD_SEL, L"Selected Text (Colors)", L"fore:#FF4000; back:#4040FF; eolfilled; alpha:80", L"" },
|
||||
/* 7 */ { {_STYLE_GETSTYLEID(STY_WHITESPACE)}, IDS_LEX_STD_WSPC, L"Whitespace (Colors, Size 0-12)", L"fore:#FF4000", L"" },
|
||||
/* 8 */ { {_STYLE_GETSTYLEID(STY_CUR_LN)}, IDS_LEX_STD_LN_BACKGR, L"Current Line Background (Color)", L"size:2; fore:#A0A0A0; back:#FFFF00; alpha:50", L"" },
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_STD_CARET, L"Caret (Color, Size 1-3)", L"size:1; ovrbar", L"" },
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_STD_CARET, L"Caret (Color, Size 1-3)", L"size:1", L"" },
|
||||
/* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_STD_LONG_LN, L"Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:2", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"size:+2; fore:#000000; back:#00DC00; alpha:100", L"" },
|
||||
@ -38,7 +38,7 @@ SCLEX_NULL, IDS_LEX_STR_63266, L"2nd Default Text", L"txt; text; tmp; log; asc;
|
||||
/* 6 */ { {_STYLE_GETSTYLEID(STY_SEL_TXT)}, IDS_LEX_2ND_SEL, L"2nd Selected Text (Colors)", L"fore:#FF4000; eolfilled", L"" },
|
||||
/* 7 */ { {_STYLE_GETSTYLEID(STY_WHITESPACE)}, IDS_LEX_2ND_WSPC, L"2nd Whitespace (Colors, Size 0-12)", L"fore:#FF4000", L"" },
|
||||
/* 8 */ { {_STYLE_GETSTYLEID(STY_CUR_LN)}, IDS_LEX_2ND_LN_BACKGR, L"2nd Current Line Background (Color)", L"size:2; fore:#0000B0; back:#FFFF00; alpha:50", L"" },
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_2ND_CARET, L"2nd Caret (Color, Size 1-3)", L"size:1; ovrbar", L"" },
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_2ND_CARET, L"2nd Caret (Color, Size 1-3)", L"size:1", 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"" },
|
||||
|
||||
21
src/Styles.c
21
src/Styles.c
@ -1134,17 +1134,18 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
|
||||
// caret style and width
|
||||
|
||||
int ovr_mask = CARETSTYLE_OVERSTRIKE_BLOCK;
|
||||
if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue, L"ovrbar")) {
|
||||
ovr_mask = CARETSTYLE_OVERSTRIKE_BAR;
|
||||
}
|
||||
int const ovrstrk_mode = (StrStr(pCurrentStandard->Styles[STY_CARET].szValue, L"ovrblck")) ?
|
||||
CARETSTYLE_OVERSTRIKE_BLOCK : CARETSTYLE_OVERSTRIKE_BAR;
|
||||
|
||||
if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue, L"block")) {
|
||||
StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; block");
|
||||
SendMessage(hwnd, SCI_SETCARETSTYLE, (CARETSTYLE_BLOCK | ovr_mask), 0);
|
||||
SendMessage(hwnd, SCI_SETCARETSTYLE, (CARETSTYLE_BLOCK | ovrstrk_mode), 0);
|
||||
if (CARETSTYLE_OVERSTRIKE_BLOCK == ovrstrk_mode) {
|
||||
StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; ovrblck");
|
||||
}
|
||||
}
|
||||
else {
|
||||
SendMessage(hwnd, SCI_SETCARETSTYLE, (CARETSTYLE_LINE | ovr_mask), 0);
|
||||
SendMessage(hwnd, SCI_SETCARETSTYLE, (CARETSTYLE_LINE | ovrstrk_mode), 0);
|
||||
|
||||
iValue = 1;
|
||||
fValue = 1.0f; // default caret width
|
||||
@ -1157,8 +1158,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
StringCchPrintf(wch, COUNTOF(wch), L"; size:%i", iValue);
|
||||
StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), wch);
|
||||
|
||||
if (CARETSTYLE_OVERSTRIKE_BAR == ovr_mask) {
|
||||
StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; ovrbar");
|
||||
if (CARETSTYLE_OVERSTRIKE_BLOCK == ovrstrk_mode) {
|
||||
StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; ovrblck");
|
||||
}
|
||||
}
|
||||
if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"noblink")) {
|
||||
@ -2674,8 +2675,8 @@ void Style_CopyStyles_IfNotDefined(LPCWSTR lpszStyleSrc, LPWSTR lpszStyleDest, i
|
||||
}
|
||||
|
||||
// -------- other style settings --------
|
||||
if (StrStrI(lpszStyleSrc, L"ovrbar") && !StrStrI(lpszStyleDest, L"ovrbar")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; ovrbar");
|
||||
if (StrStrI(lpszStyleSrc, L"ovrblck") && !StrStrI(lpszStyleDest, L"ovrblck")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; ovrblck");
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"block") && !StrStrI(lpszStyleDest, L"block")) {
|
||||
|
||||
@ -306,7 +306,7 @@ typedef struct _globals_t
|
||||
bool bIniFileFromScratch;
|
||||
bool bFindReplCopySelOrClip;
|
||||
bool bReplaceInitialized;
|
||||
bool bInconsistentLineBreaks;
|
||||
bool bDocHasInconsistentEOLs;
|
||||
|
||||
FR_STATES FindReplaceMatchFoundState;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user