diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index 6773aaf75..3d8aa71b8 100644 --- a/Build/Notepad3.ini +++ b/Build/Notepad3.ini @@ -15,7 +15,7 @@ SettingsVersion=4 ;filebrowser.exe=minipath.exe ;FileCheckInverval=2000 ;FileDlgFilters= -;FileLoadWarningMB=1 +;FileLoadWarningMB=256 ;MarkOccurrencesMaxCount=2000 ;MultiFileArg=0 ;NoCGIGuess=0 diff --git a/Versions/build.txt b/Versions/build.txt index dcd069339..5c8cd84c0 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2516 +2517 diff --git a/np3portableapp/_buildname.txt b/np3portableapp/_buildname.txt index 463000ad2..2ea7a7adf 100644 --- a/np3portableapp/_buildname.txt +++ b/np3portableapp/_buildname.txt @@ -1 +1 @@ -"RC" +"RC2" diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index befb67570..652a376f8 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,8 +3,8 @@ - Notepad3 RC + Notepad3 RC2 diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index 7000585c9..7819a682a 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -351,6 +351,7 @@ extern "C" bool IniFileIterateSection(LPCWSTR lpFilePath, LPCWSTR lpSectionName, // get all keys in a section CSimpleIniW::TNamesDepend keyList; Ini.GetAllKeys(lpSectionName, keyList); + keyList.sort(CSimpleIniW::Entry::LoadOrder()); for (const auto& key : keyList) { @@ -705,7 +706,7 @@ void LoadSettings() Settings2.DefaultWindowPosition, COUNTOF(Settings2.DefaultWindowPosition)); bool const bExplicitDefaultWinPos = (StringCchLenW(Settings2.DefaultWindowPosition, 0) != 0); - Defaults2.FileLoadWarningMB = 1; + Defaults2.FileLoadWarningMB = 256; Settings2.FileLoadWarningMB = clampi(IniSectionGetInt(Settings2_Section, L"FileLoadWarningMB", Defaults2.FileLoadWarningMB), 0, 2048); Defaults2.OpacityLevel = 75; diff --git a/src/Dialogs.c b/src/Dialogs.c index a433aee02..1a3bb9213 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -221,8 +221,8 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, SetDlgItemText(hwnd, IDC_INFOBOXTEXT, lpMsgBox->lpstrMessage); if (lpMsgBox->bDisableCheckBox) { - DialogEnableWindow(hwnd, IDC_INFOBOXCHECK, false); - DialogHideWindow(hwnd, IDC_INFOBOXCHECK, true); + DialogEnableControl(hwnd, IDC_INFOBOXCHECK, false); + DialogHideControl(hwnd, IDC_INFOBOXCHECK, true); } CenterDlgInParent(hwnd); @@ -243,21 +243,26 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, switch (LOWORD(wParam)) { case IDOK: - case IDCANCEL: case IDYES: - case IDNO: + case IDCONTINUE: if (IsButtonChecked(hwnd, IDC_INFOBOXCHECK) && StrIsNotEmpty(lpMsgBox->lpstrSetting)) { - IniFileSetInt(Globals.IniFile, L"Suppressed Messages", lpMsgBox->lpstrSetting, LOWORD(wParam)); + IniFileSetInt(Globals.IniFile, Constants.SectionSuppressedMessages, lpMsgBox->lpstrSetting, LOWORD(wParam)); } + case IDCANCEL: + case IDNO: case IDABORT: case IDRETRY: case IDIGNORE: case IDCLOSE: case IDTRYAGAIN: - case IDCONTINUE: EndDialog(hwnd, LOWORD(wParam)); return true; + case IDC_INFOBOXCHECK: + DialogEnableControl(hwnd, IDNO, !IsButtonChecked(hwnd, IDC_INFOBOXCHECK)); + DialogEnableControl(hwnd, IDCANCEL, !IsButtonChecked(hwnd, IDC_INFOBOXCHECK)); + break; + default: break; } @@ -274,8 +279,18 @@ 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 : IniFileGetInt(Globals.IniFile, L"Suppressed Messages", lpstrSetting, 0); - if (iMode > 0) { return iMode; } + int const iMode = StrIsEmpty(lpstrSetting) ? 0 : IniFileGetInt(Globals.IniFile, Constants.SectionSuppressedMessages, lpstrSetting, 0); + switch (iMode) { + case IDOK: + case IDYES: + case IDCONTINUE: + return iMode; + case 0: + break; + default: + IniFileDelete(Globals.IniFile, Constants.SectionSuppressedMessages, lpstrSetting, false); + break; + } WCHAR wchMessage[LARGE_BUFFER]; if (!GetLngString(uidMsg, wchMessage, COUNTOF(wchMessage))) { return -1LL; } @@ -320,7 +335,7 @@ INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMsg, ...) } msgBox.lpstrSetting = (LPWSTR)lpstrSetting; - msgBox.bDisableCheckBox = (StrIsEmpty(Globals.IniFile) || StrIsEmpty(lpstrSetting) || (iMode < 0)) ? true : false; + msgBox.bDisableCheckBox = (StrIsEmpty(Globals.IniFile) || StrIsEmpty(lpstrSetting)) ? true : false; int idDlg; @@ -944,7 +959,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPar } } } - DialogEnableWindow(hwnd,IDOK,bEnableOK); + DialogEnableControl(hwnd,IDOK,bEnableOK); } break; @@ -1118,7 +1133,7 @@ static INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM case LVN_ITEMCHANGED: { NM_LISTVIEW *pnmlv = (NM_LISTVIEW*)lParam; - DialogEnableWindow(hwnd,IDOK,(pnmlv->uNewState & LVIS_SELECTED)); + DialogEnableControl(hwnd,IDOK,(pnmlv->uNewState & LVIS_SELECTED)); } break; @@ -1317,7 +1332,7 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA case LVN_ITEMCHANGED: { NM_LISTVIEW *pnmlv = (NM_LISTVIEW*)lParam; - DialogEnableWindow(hwnd,IDOK,(pnmlv->uNewState & LVIS_SELECTED)); + DialogEnableControl(hwnd,IDOK,(pnmlv->uNewState & LVIS_SELECTED)); } break; @@ -1462,7 +1477,7 @@ static INT_PTR CALLBACK AddToFavDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA switch (LOWORD(wParam)) { case IDC_ADDFAV_FILES: - DialogEnableWindow(hwnd, IDOK, GetWindowTextLength(GetDlgItem(hwnd, IDC_ADDFAV_FILES))); + DialogEnableControl(hwnd, IDOK, GetWindowTextLength(GetDlgItem(hwnd, IDC_ADDFAV_FILES))); break; case IDOK: @@ -1810,8 +1825,8 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM case LVN_DELETEITEM: { UINT cnt = ListView_GetSelectedCount(GetDlgItem(hwnd, IDC_FILEMRU)); - DialogEnableWindow(hwnd, IDOK, (cnt > 0)); - DialogEnableWindow(hwnd, IDC_REMOVE, (cnt > 0)); + DialogEnableControl(hwnd, IDOK, (cnt > 0)); + DialogEnableControl(hwnd, IDC_REMOVE, (cnt > 0)); } break; } @@ -1934,8 +1949,8 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM // (LB_ERR != SendDlgItemMessage(hwnd,IDC_GOTO,LB_GETCURSEL,0,0))); cnt = ListView_GetSelectedCount(GetDlgItem(hwnd, IDC_FILEMRU)); - DialogEnableWindow(hwnd, IDOK, (cnt > 0)); - DialogEnableWindow(hwnd, IDC_REMOVE, (cnt > 0)); + DialogEnableControl(hwnd, IDOK, (cnt > 0)); + DialogEnableControl(hwnd, IDC_REMOVE, (cnt > 0)); } } @@ -2505,7 +2520,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP CheckDlgButton(hwnd, IDC_NOUNICODEDETECTION, SetBtn(Settings.SkipUnicodeDetection)); CheckDlgButton(hwnd, IDC_NOANSICPDETECTION, SetBtn(Settings.SkipANSICodePageDetection)); - DialogEnableWindow(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc)); + DialogEnableControl(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc)); CenterDlgInParent(hwnd); } @@ -2533,11 +2548,11 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP if (s_iEnc == CPI_UTF8) { if (s_bUseAsFallback) { CheckDlgButton(hwnd, IDC_ASCIIASUTF8, SetBtn(true)); - DialogEnableWindow(hwnd, IDC_ASCIIASUTF8, false); + DialogEnableControl(hwnd, IDC_ASCIIASUTF8, false); } else { - DialogEnableWindow(hwnd, IDC_ASCIIASUTF8, true); + DialogEnableControl(hwnd, IDC_ASCIIASUTF8, true); CheckDlgButton(hwnd, IDC_ASCIIASUTF8, SetBtn(s_bLoadASCIIasUTF8)); } } @@ -2551,24 +2566,24 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP if (s_iEnc == CPI_UTF8) { if (s_bUseAsFallback) { - DialogEnableWindow(hwnd, IDC_ASCIIASUTF8, false); + DialogEnableControl(hwnd, IDC_ASCIIASUTF8, false); CheckDlgButton(hwnd, IDC_ASCIIASUTF8, SetBtn(true)); } - DialogEnableWindow(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc)); + DialogEnableControl(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc)); CheckDlgButton(hwnd, IDC_USEASREADINGFALLBACK, SetBtn(s_bUseAsFallback)); } else if (s_iEnc == CPI_ANSI_DEFAULT) { - DialogEnableWindow(hwnd, IDC_ASCIIASUTF8, true); + DialogEnableControl(hwnd, IDC_ASCIIASUTF8, true); CheckDlgButton(hwnd, IDC_ASCIIASUTF8, SetBtn(s_bLoadASCIIasUTF8)); s_bUseAsFallback = true; - DialogEnableWindow(hwnd, IDC_USEASREADINGFALLBACK, false); + DialogEnableControl(hwnd, IDC_USEASREADINGFALLBACK, false); CheckDlgButton(hwnd, IDC_USEASREADINGFALLBACK, SetBtn(s_bUseAsFallback)); } else { s_bUseAsFallback = Encoding_IsASCII(s_iEnc) ? Settings.UseDefaultForFileEncoding : false; - DialogEnableWindow(hwnd, IDC_ASCIIASUTF8, true); + DialogEnableControl(hwnd, IDC_ASCIIASUTF8, true); CheckDlgButton(hwnd, IDC_ASCIIASUTF8, SetBtn(s_bLoadASCIIasUTF8)); - DialogEnableWindow(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc)); + DialogEnableControl(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc)); CheckDlgButton(hwnd, IDC_USEASREADINGFALLBACK, SetBtn(s_bUseAsFallback)); } } @@ -2729,7 +2744,7 @@ static INT_PTR CALLBACK SelectEncodingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam, case LVN_ITEMCHANGED: case LVN_DELETEITEM: { int i = ListView_GetNextItem(hwndLV,-1,LVNI_ALL | LVNI_SELECTED); - DialogEnableWindow(hwnd,IDOK,i != -1); + DialogEnableControl(hwnd,IDOK,i != -1); } break; } diff --git a/src/Dialogs.h b/src/Dialogs.h index 46e1ff09b..1177981a2 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -110,10 +110,10 @@ LRESULT SendWMSize(HWND hwnd, RECT* rc); inline void SimpleBeep() { if (!Settings.MuteMessageBeep) { MessageBeep(0xFFFFFFFF); } } inline void AttentionBeep(UINT uType) { if (!Settings.MuteMessageBeep) { MessageBeep(uType & MB_ICONMASK); } } -#define DialogEnableWindow(hdlg, id, b) { HWND hctrl = GetDlgItem((hdlg),(id)); if (!(b)) { \ +#define DialogEnableControl(hdlg, id, b) { HWND hctrl = GetDlgItem((hdlg),(id)); if (!(b)) { \ if (GetFocus() == hctrl) { SendMessage((hdlg), WM_NEXTDLGCTL, 0, false); } }; EnableWindow(hctrl, (b)); } -#define DialogHideWindow(hdlg, id, b) { HWND hctrl = GetDlgItem((hdlg),(id)); if (!(b)) { \ +#define DialogHideControl(hdlg, id, b) { HWND hctrl = GetDlgItem((hdlg),(id)); if (!(b)) { \ if (GetFocus() == hctrl) { SendMessage((hdlg), WM_NEXTDLGCTL, 0, false); } }; ShowWindow(hctrl, (b)?SW_HIDE:SW_SHOW); } diff --git a/src/Edit.c b/src/Edit.c index b26b4d8d2..a1e173472 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -969,19 +969,18 @@ bool EditLoadFile( INT_PTR const answer = InfoBoxLng(MB_YESNO, L"MsgFileUnknownExt", IDS_MUI_WARN_UNKNOWN_EXT, PathFindFileName(pszFile)); if (!((IDOK == answer) || (IDYES == answer))) { CloseHandle(hFile); - status->bUnknownExt = true; Encoding_SrcCmdLn(CPI_NONE); Encoding_SrcWeak(CPI_NONE); return false; } } else { - status->bUnknownExt = true; + 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)) { + DWORD dwFileSizeLimit = (DWORD)Settings2.FileLoadWarningMB; + if ((dwFileSizeLimit != 0LL) && ((dwFileSizeLimit * 1024LL * 1024LL) < dwFileSize)) { if (InfoBoxLng(MB_YESNO, L"MsgFileSizeWarning", IDS_MUI_WARN_LOAD_BIG_FILE) != IDYES) { CloseHandle(hFile); status->bFileTooBig = true; @@ -5171,7 +5170,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (sg_pefrData->fuFlags & SCFIND_REGEXP) { CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_CHECKED); CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true); + DialogEnableControl(hwnd, IDC_DOT_MATCH_ALL, true); } if (sg_pefrData->bDotMatchAll) { @@ -5181,7 +5180,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (sg_pefrData->bWildcardSearch) { CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_CHECKED); - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + DialogEnableControl(hwnd, IDC_DOT_MATCH_ALL, false); } if (sg_pefrData->bMarkOccurences) { @@ -5195,10 +5194,10 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (sg_pefrData->fuFlags & SCFIND_REGEXP) { CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); + DialogEnableControl(hwnd, IDC_FINDTRANSFORMBS, false); } else { - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + DialogEnableControl(hwnd, IDC_DOT_MATCH_ALL, false); } if (sg_pefrData->bNoFindWrap) { @@ -5397,7 +5396,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara } bool const bEnableReplInSel = !(SciCall_IsSelectionEmpty() || Sci_IsMultiOrRectangleSelection()); - DialogEnableWindow(hwnd, IDC_REPLACEINSEL, bEnableReplInSel); + DialogEnableControl(hwnd, IDC_REPLACEINSEL, bEnableReplInSel); _DelayMarkAll(hwnd, 50, s_InitialSearchStart); @@ -5504,12 +5503,12 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara bool const bEnableIS = !(SciCall_IsSelectionEmpty() || Sci_IsMultiOrRectangleSelection()); - DialogEnableWindow(hwnd, IDOK, bEnableF); - DialogEnableWindow(hwnd, IDC_FINDPREV, bEnableF); - DialogEnableWindow(hwnd, IDC_REPLACE, bEnableF); - DialogEnableWindow(hwnd, IDC_REPLACEALL, bEnableF); - DialogEnableWindow(hwnd, IDC_REPLACEINSEL, bEnableF && bEnableIS); - DialogEnableWindow(hwnd, IDC_SWAPSTRG, bEnableF || bEnableR); + DialogEnableControl(hwnd, IDOK, bEnableF); + DialogEnableControl(hwnd, IDC_FINDPREV, bEnableF); + DialogEnableControl(hwnd, IDC_REPLACE, bEnableF); + DialogEnableControl(hwnd, IDC_REPLACEALL, bEnableF); + DialogEnableControl(hwnd, IDC_REPLACEINSEL, bEnableF && bEnableIS); + DialogEnableControl(hwnd, IDC_SWAPSTRG, bEnableF || bEnableR); if (!bEnableF) { s_anyMatch = s_fwrdMatch = NO_MATCH; } @@ -5579,11 +5578,11 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (IsButtonChecked(hwnd, IDC_ALL_OCCURRENCES)) { - DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, true); + DialogEnableControl(hwnd, IDC_TOGGLE_VISIBILITY, true); _DelayMarkAll(hwnd, 0, s_InitialSearchStart); } else { // switched OFF - DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false); + DialogEnableControl(hwnd, IDC_TOGGLE_VISIBILITY, false); if (FocusedView.HideNonMatchedLines) { EditToggleView(sg_pefrData->hwnd); } @@ -5609,15 +5608,15 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara case IDC_FINDREGEXP: if (IsButtonChecked(hwnd, IDC_FINDREGEXP)) { - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true); + DialogEnableControl(hwnd, IDC_DOT_MATCH_ALL, true); CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); // Can not use wildcard search together with regexp CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, SetBtn(s_SaveTFBackSlashes)); CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); + DialogEnableControl(hwnd, IDC_FINDTRANSFORMBS, false); } else { // unchecked - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true); + DialogEnableControl(hwnd, IDC_DOT_MATCH_ALL, false); + DialogEnableControl(hwnd, IDC_FINDTRANSFORMBS, true); CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, SetBtn(s_SaveTFBackSlashes)); } _SetSearchFlags(hwnd, sg_pefrData); @@ -5633,13 +5632,13 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (IsButtonChecked(hwnd, IDC_WILDCARDSEARCH)) { CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + DialogEnableControl(hwnd, IDC_DOT_MATCH_ALL, false); CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, SetBtn(s_SaveTFBackSlashes)); CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); + DialogEnableControl(hwnd, IDC_FINDTRANSFORMBS, false); } else { // unchecked - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true); + DialogEnableControl(hwnd, IDC_FINDTRANSFORMBS, true); CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, SetBtn(s_SaveTFBackSlashes)); } _SetSearchFlags(hwnd, sg_pefrData); @@ -5693,13 +5692,13 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (!s_bSwitchedFindReplace && !GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, sg_pefrData->szFind, COUNTOF(sg_pefrData->szFind))) { - DialogEnableWindow(hwnd, IDOK, false); - DialogEnableWindow(hwnd, IDC_FINDPREV, false); - DialogEnableWindow(hwnd, IDC_REPLACE, false); - DialogEnableWindow(hwnd, IDC_REPLACEALL, false); - DialogEnableWindow(hwnd, IDC_REPLACEINSEL, false); + DialogEnableControl(hwnd, IDOK, false); + DialogEnableControl(hwnd, IDC_FINDPREV, false); + DialogEnableControl(hwnd, IDC_REPLACE, false); + DialogEnableControl(hwnd, IDC_REPLACEALL, false); + DialogEnableControl(hwnd, IDC_REPLACEINSEL, false); if (!GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, sg_pefrData->szReplace, COUNTOF(sg_pefrData->szReplace))) - DialogEnableWindow(hwnd, IDC_SWAPSTRG, false); + DialogEnableControl(hwnd, IDC_SWAPSTRG, false); return true; } @@ -7805,13 +7804,13 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM } else if (*piSortFlags & SORT_SHUFFLE) { CheckRadioButton(hwnd,100,102,102); - DialogEnableWindow(hwnd,103,false); - DialogEnableWindow(hwnd,104,false); - DialogEnableWindow(hwnd,105,false); - DialogEnableWindow(hwnd,106,false); - DialogEnableWindow(hwnd,107,false); - DialogEnableWindow(hwnd,108,false); - DialogEnableWindow(hwnd,109,false); + DialogEnableControl(hwnd,103,false); + DialogEnableControl(hwnd,104,false); + DialogEnableControl(hwnd,105,false); + DialogEnableControl(hwnd,106,false); + DialogEnableControl(hwnd,107,false); + DialogEnableControl(hwnd,108,false); + DialogEnableControl(hwnd,109,false); } else { CheckRadioButton(hwnd, 100, 102, 100); @@ -7821,7 +7820,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM } if (*piSortFlags & SORT_UNIQDUP) { CheckDlgButton(hwnd, 104, BST_CHECKED); - DialogEnableWindow(hwnd, 103, false); + DialogEnableControl(hwnd, 103, false); } if (*piSortFlags & SORT_UNIQUNIQ) { CheckDlgButton(hwnd, 105, BST_CHECKED); @@ -7832,7 +7831,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM if (*piSortFlags & SORT_REMWSPACELN) { CheckDlgButton(hwnd, 107, BST_CHECKED); CheckDlgButton(hwnd, 106, BST_CHECKED); - DialogEnableWindow(hwnd, 106, false); + DialogEnableControl(hwnd, 106, false); } if (*piSortFlags & SORT_NOCASE) { CheckDlgButton(hwnd, 108, BST_CHECKED); @@ -7842,7 +7841,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM } if (!Sci_IsMultiOrRectangleSelection()) { *piSortFlags &= ~SORT_COLUMN; - DialogEnableWindow(hwnd,110,false); + DialogEnableControl(hwnd,110,false); } else { *piSortFlags |= SORT_COLUMN; @@ -7893,33 +7892,33 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM case 100: case 101: - DialogEnableWindow(hwnd,103, IsButtonUnchecked(hwnd,105)); - DialogEnableWindow(hwnd,104,true); - DialogEnableWindow(hwnd,105,true); - DialogEnableWindow(hwnd,106,true); - DialogEnableWindow(hwnd,107,true); - DialogEnableWindow(hwnd,108,true); - DialogEnableWindow(hwnd,109,true); + DialogEnableControl(hwnd,103, IsButtonUnchecked(hwnd,105)); + DialogEnableControl(hwnd,104,true); + DialogEnableControl(hwnd,105,true); + DialogEnableControl(hwnd,106,true); + DialogEnableControl(hwnd,107,true); + DialogEnableControl(hwnd,108,true); + DialogEnableControl(hwnd,109,true); break; case 102: - DialogEnableWindow(hwnd,103,false); - DialogEnableWindow(hwnd,104,false); - DialogEnableWindow(hwnd,105,false); - DialogEnableWindow(hwnd,106,false); - DialogEnableWindow(hwnd,107,false); - DialogEnableWindow(hwnd,108,false); - DialogEnableWindow(hwnd,109,false); + DialogEnableControl(hwnd,103,false); + DialogEnableControl(hwnd,104,false); + DialogEnableControl(hwnd,105,false); + DialogEnableControl(hwnd,106,false); + DialogEnableControl(hwnd,107,false); + DialogEnableControl(hwnd,108,false); + DialogEnableControl(hwnd,109,false); break; case 104: - DialogEnableWindow(hwnd,103,IsButtonUnchecked(hwnd,104)); + DialogEnableControl(hwnd,103,IsButtonUnchecked(hwnd,104)); break; case 107: if (IsButtonChecked(hwnd, 107)) { CheckDlgButton(hwnd, 106, BST_CHECKED); - DialogEnableWindow(hwnd, 106, false); + DialogEnableControl(hwnd, 106, false); } else { - DialogEnableWindow(hwnd, 106, true); + DialogEnableControl(hwnd, 106, true); } break; default: diff --git a/src/Notepad3.c b/src/Notepad3.c index 1f5254f1f..daa151374 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -48,7 +48,11 @@ * Local and global Variables for Notepad3.c * */ -CONSTANTS_T const Constants = { 2, L"minipath.exe" }; +CONSTANTS_T const Constants = { + 2 // StdDefaultLexerID + , L"minipath.exe" // FileBrowserMiniPath + , L"Suppressed Messages" // SectionSuppressedMessages +}; FLAGS_T Flags; FLAGS_T DefaultFlags; diff --git a/src/Styles.c b/src/Styles.c index 6ee6966b2..af268df49 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -626,17 +626,16 @@ bool Style_ImportFromFile(const WCHAR* szFile) // handling "Text Files" lexer if (StringCchCompareXI(L"Text Files", g_pLexArray[iLexer]->pszName) == 0) { - StringCchCopyW(g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions), g_pLexArray[0]->szExtensions); - StringCchCatW(g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions), L"; "); - StringCchCatW(g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions), g_pLexArray[1]->szExtensions); - StrTrim(g_pLexArray[iLexer]->szExtensions, L"; "); + if (StrIsNotEmpty(g_pLexArray[0]->szExtensions)) { + StringCchCopyW(g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions), g_pLexArray[0]->szExtensions); + StrTrim(g_pLexArray[iLexer]->szExtensions, L"; "); + } lexStandard.szExtensions[0] = L'\0'; lexStandard2nd.szExtensions[0] = L'\0'; // copy default style StringCchCopyW(g_pLexArray[iLexer]->Styles[0].szValue, COUNTOF(g_pLexArray[iLexer]->Styles[0].szValue), g_pLexArray[0]->Styles[0].szValue); } } - } ReleaseIniFile(); @@ -3808,7 +3807,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam return true; case WM_ACTIVATE: - DialogEnableWindow(hwnd, IDC_PREVIEW, ((pCurrentLexer == s_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); + DialogEnableControl(hwnd, IDC_PREVIEW, ((pCurrentLexer == s_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); return true; case WM_DPICHANGED: @@ -3927,9 +3926,9 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam bIsStyleSelected = false; GetLngString(IDS_MUI_ASSOCIATED_EXT, label, COUNTOF(label)); SetDlgItemText(hwnd,IDC_STYLELABEL_ROOT, label); - DialogEnableWindow(hwnd,IDC_STYLEEDIT_ROOT,true); + DialogEnableControl(hwnd,IDC_STYLEEDIT_ROOT,true); SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->szExtensions); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, true); + DialogEnableControl(hwnd, IDC_STYLEEDIT_ROOT, true); if (IsLexerStandard(pCurrentLexer)) { @@ -3941,16 +3940,16 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam } else { GetLngString(IDS_MUI_STY_BASE2ND, label, COUNTOF(label)); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); + DialogEnableControl(hwnd, IDC_STYLEEDIT_ROOT, false); } - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); + DialogEnableControl(hwnd, IDC_STYLEEDIT_ROOT, false); } else { pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); iCurStyleIdx = STY_DEFAULT; GetLngString(pCurrentLexer->resID, name, COUNTOF(name)); FormatLngStringW(label, COUNTOF(label), IDS_MUI_STY_LEXDEF, name); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, true); + DialogEnableControl(hwnd, IDC_STYLEEDIT_ROOT, true); } SetDlgItemText(hwnd, IDC_STYLELABEL, label); SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); @@ -3958,11 +3957,11 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam else { SetDlgItemText(hwnd,IDC_STYLELABEL_ROOT,L""); - DialogEnableWindow(hwnd,IDC_STYLEEDIT_ROOT,false); + DialogEnableControl(hwnd,IDC_STYLEEDIT_ROOT,false); SetDlgItemText(hwnd, IDC_STYLELABEL, L""); - DialogEnableWindow(hwnd, IDC_STYLEEDIT, false); + DialogEnableControl(hwnd, IDC_STYLEEDIT, false); } - DialogEnableWindow(hwnd, IDC_PREVIEW, ((pCurrentLexer == s_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); + DialogEnableControl(hwnd, IDC_PREVIEW, ((pCurrentLexer == s_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); } // a style has been selected else @@ -3981,7 +3980,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam SetDlgItemText(hwnd, IDC_STYLELABEL_ROOT, label); SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->Styles[STY_DEFAULT].szValue); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); + DialogEnableControl(hwnd, IDC_STYLEEDIT_ROOT, false); pCurrentStyle = (PEDITSTYLE)lpnmtv->itemNew.lParam; iCurStyleIdx = -1; @@ -4007,7 +4006,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam { iCurStyleIdx = -1; SetDlgItemText(hwnd, IDC_STYLELABEL, L""); - DialogEnableWindow(hwnd, IDC_STYLEEDIT, false); + DialogEnableControl(hwnd, IDC_STYLEEDIT, false); } } } @@ -4559,8 +4558,8 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR { int i = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); CheckDlgButton(hwnd, IDC_DEFAULTSCHEME, SetBtn(iInternalDefault == i)); - DialogEnableWindow(hwnd, IDC_DEFAULTSCHEME, i != -1); - DialogEnableWindow(hwnd, IDOK, i != -1); + DialogEnableControl(hwnd, IDC_DEFAULTSCHEME, i != -1); + DialogEnableControl(hwnd, IDOK, i != -1); } break; } diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 727412935..25c48e25f 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -272,6 +272,7 @@ typedef struct _constants_t { int const StdDefaultLexerID; // Pure Text Files const WCHAR* const FileBrowserMiniPath; + const WCHAR* const SectionSuppressedMessages; } CONSTANTS_T, *PCONSTANTS_T; diff --git a/src/VersionEx.h b/src/VersionEx.h index f2670c240..93311ebee 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -7,8 +7,8 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 19 -#define VERSION_REV 729 -#define VERSION_BUILD 2516 +#define VERSION_REV 730 +#define VERSION_BUILD 2517 #define SCINTILLA_VER 420 #define ONIGURUMA_REGEX_VER 6.9.3 -#define VERSION_PATCH RC +#define VERSION_PATCH RC2