+ File History:

+ add remove button for list items
  + checkbox for "preserve caret position" settings
  + small fixes
This commit is contained in:
Rainer Kottenhoff 2017-10-16 17:18:08 +02:00
parent 3f0a464cc5
commit bd802ba7b7
7 changed files with 160 additions and 159 deletions

View File

@ -889,8 +889,7 @@ INT_PTR CALLBACK AddToFavDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam
{
case 100:
EnableWindow(GetDlgItem(hwnd,IDOK),
GetWindowTextLength(GetDlgItem(hwnd,100)));
EnableWindow(GetDlgItem(hwnd,IDOK),GetWindowTextLength(GetDlgItem(hwnd,100)));
break;
@ -961,6 +960,7 @@ BOOL AddToFavDlg(HWND hwnd,LPCWSTR lpszName,LPCWSTR lpszTarget)
//
extern LPMRULIST pFileMRU;
extern BOOL bSaveRecentFiles;
extern BOOL bPreserveCaretPos;
extern int cxFileMRUDlg;
extern int cyFileMRUDlg;
extern int flagNoFadeHidden;
@ -1095,7 +1095,12 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
SendMessage(hwnd,WM_COMMAND,MAKELONG(0x00A0,1),0);
if (bSaveRecentFiles)
CheckDlgButton(hwnd,IDC_SAVEMRU,BST_CHECKED);
CheckDlgButton(hwnd, IDC_SAVEMRU, BST_CHECKED);
if (bPreserveCaretPos)
CheckDlgButton(hwnd, IDC_PRESERVECARET, BST_CHECKED);
//if (!bSaveRecentFiles) EnableWindow(GetDlgItem(hwnd, IDC_PRESERVECARET), FALSE);
CenterDlgInParent(hwnd);
}
@ -1118,7 +1123,8 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
RemoveProp(hwnd,L"it");
GlobalFree(lpit);
bSaveRecentFiles = (IsDlgButtonChecked(hwnd,IDC_SAVEMRU)) ? 1 : 0;
bPreserveCaretPos = (IsDlgButtonChecked(hwnd, IDC_PRESERVECARET)) ? TRUE : FALSE;
bSaveRecentFiles = (IsDlgButtonChecked(hwnd, IDC_SAVEMRU)) ? TRUE : FALSE;
ResizeDlg_Destroy(hwnd,&cxFileMRUDlg,&cyFileMRUDlg);
}
@ -1137,7 +1143,9 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
hdwp = DeferCtlPos(hdwp,hwnd,IDC_RESIZEGRIP,dx,dy,SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp,hwnd,IDOK,dx,dy,SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp,hwnd,IDCANCEL,dx,dy,SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp,hwnd,IDC_REMOVE,dx,dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp,hwnd,IDC_FILEMRU,dx,dy,SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp,hwnd,IDC_PRESERVECARET,0,dy,SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp,hwnd,IDC_SAVEMRU,0,dy,SWP_NOSIZE);
EndDeferWindowPos(hdwp);
ListView_SetColumnWidth(GetDlgItem(hwnd,IDC_FILEMRU),0,LVSCW_AUTOSIZE_USEHEADER);
@ -1228,7 +1236,11 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
case LVN_ITEMCHANGED:
case LVN_DELETEITEM:
EnableWindow(GetDlgItem(hwnd,IDOK),ListView_GetSelectedCount(GetDlgItem(hwnd,IDC_FILEMRU)));
{
UINT cnt = ListView_GetSelectedCount(GetDlgItem(hwnd, IDC_FILEMRU));
EnableWindow(GetDlgItem(hwnd, IDOK), (cnt > 0));
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), (cnt > 0));
}
break;
}
}
@ -1292,51 +1304,63 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
case IDC_FILEMRU:
break;
case IDOK:
case IDC_REMOVE:
{
WCHAR tch[MAX_PATH] = { L'\0' };
WCHAR tchFileName[MAX_PATH] = { L'\0' };
//int iItem;
//if ((iItem = SendDlgItemMessage(hwnd,IDC_FILEMRU,LB_GETCURSEL,0,0)) != LB_ERR)
if (ListView_GetSelectedCount(GetDlgItem(hwnd,IDC_FILEMRU)))
UINT cnt = ListView_GetSelectedCount(GetDlgItem(hwnd, IDC_FILEMRU));
if (cnt > 0)
{
//SendDlgItemMessage(hwnd,IDC_FILEMRU,LB_GETTEXT,(WPARAM)iItem,(LPARAM)tch);
LV_ITEM lvi;
ZeroMemory(&lvi,sizeof(LV_ITEM));
lvi.mask = LVIF_TEXT;
lvi.pszText = tch;
lvi.cchTextMax = COUNTOF(tch);
lvi.pszText = tchFileName;
lvi.cchTextMax = COUNTOF(tchFileName);
lvi.iItem = ListView_GetNextItem(GetDlgItem(hwnd,IDC_FILEMRU),-1,LVNI_ALL | LVNI_SELECTED);
ListView_GetItem(GetDlgItem(hwnd,IDC_FILEMRU),&lvi);
PathUnquoteSpaces(tch);
PathUnquoteSpaces(tchFileName);
if (!PathFileExists(tch)) {
if (!PathFileExists(tchFileName) || (LOWORD(wParam) == IDC_REMOVE)) {
// don't remove myself
int iCur = 0;
if (!MRU_FindFile(pFileMRU, szCurFile, &iCur)) {
iCur = -1;
}
// Ask...
if (IDYES == MsgBox(MBYESNO,IDS_ERR_MRUDLG)) {
int answ = (LOWORD(wParam) == IDOK) ? MsgBox(MBYESNO, IDS_ERR_MRUDLG)
: ((iCur == lvi.iItem) ? IDNO : IDYES);
MRU_Delete(pFileMRU,lvi.iItem);
MRU_DeleteFileFromStore(pFileMRU,tch);
if (IDYES == answ) {
//SendDlgItemMessage(hwnd,IDC_FILEMRU,LB_DELETESTRING,(WPARAM)iItem,0);
//ListView_DeleteItem(GetDlgItem(hwnd,IDC_FILEMRU),lvi.iItem);
// must use IDM_VIEW_REFRESH, index might change...
SendMessage(hwnd,WM_COMMAND,MAKELONG(0x00A0,1),0);
MRU_Delete(pFileMRU,lvi.iItem);
MRU_DeleteFileFromStore(pFileMRU,tchFileName);
//EnableWindow(GetDlgItem(hwnd,IDOK),
// (LB_ERR != SendDlgItemMessage(hwnd,IDC_GOTO,LB_GETCURSEL,0,0)));
//SendDlgItemMessage(hwnd,IDC_FILEMRU,LB_DELETESTRING,(WPARAM)iItem,0);
//ListView_DeleteItem(GetDlgItem(hwnd,IDC_FILEMRU),lvi.iItem);
// must use IDM_VIEW_REFRESH, index might change...
SendMessage(hwnd,WM_COMMAND,MAKELONG(0x00A0,1),0);
EnableWindow(GetDlgItem(hwnd,IDOK),
ListView_GetSelectedCount(GetDlgItem(hwnd,IDC_FILEMRU)));
//EnableWindow(GetDlgItem(hwnd,IDOK),
// (LB_ERR != SendDlgItemMessage(hwnd,IDC_GOTO,LB_GETCURSEL,0,0)));
cnt = ListView_GetSelectedCount(GetDlgItem(hwnd, IDC_FILEMRU));
EnableWindow(GetDlgItem(hwnd, IDOK), (cnt > 0));
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), (cnt > 0));
}
}
else {
StringCchCopy((LPWSTR)GetWindowLongPtr(hwnd,DWLP_USER),MAX_PATH,tch);
StringCchCopy((LPWSTR)GetWindowLongPtr(hwnd,DWLP_USER),MAX_PATH,tchFileName);
EndDialog(hwnd,IDOK);
}
}

View File

@ -59,6 +59,7 @@ extern BOOL bReplaceInitialized;
static EDITFINDREPLACE efrSave;
static BOOL bSwitchedFindReplace = FALSE;
static int xFindReplaceDlgSave;
static int yFindReplaceDlgSave;
extern int xFindReplaceDlg;
@ -4124,6 +4125,7 @@ void EditJumpTo(HWND hwnd,int iNewLine,int iNewCol)
}
iNewPos = min(iNewPos,iLineEndPos);
EditSelectEx(hwnd,-1,iNewPos); // SCI_GOTOPOS(pos) is equivalent to SCI_SETSEL(-1, pos)
SendMessage(hwnd,SCI_CHOOSECARETX,0,0);
}
@ -5644,23 +5646,7 @@ INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPa
if (iNewLine > 0 && iNewLine <= iMaxLine && iNewCol > 0)
{
//int iNewPos = SendMessage(hwndEdit,SCI_POSITIONFROMLINE,(WPARAM)iNewLine-1,0);
//int iLineEndPos = SendMessage(hwndEdit,SCI_GETLINEENDPOSITION,(WPARAM)iNewLine-1,0);
//while (iNewCol-1 > SendMessage(hwndEdit,SCI_GETCOLUMN,(WPARAM)iNewPos,0))
//{
// if (iNewPos >= iLineEndPos)
// break;
// iNewPos = SendMessage(hwndEdit,SCI_POSITIONAFTER,(WPARAM)iNewPos,0);
//}
//iNewPos = min(iNewPos,iLineEndPos);
//SendMessage(hwndEdit,SCI_GOTOPOS,(WPARAM)iNewPos,0);
//SendMessage(hwndEdit,SCI_CHOOSECARETX,0,0);
EditJumpTo(hwndEdit,iNewLine,iNewCol);
EndDialog(hwnd,IDOK);
}
@ -6483,8 +6469,8 @@ extern BOOL bTabsAsSpaces;
extern BOOL bTabsAsSpacesG;
extern BOOL bTabIndents;
extern BOOL bTabIndentsG;
extern int fWordWrap;
extern int fWordWrapG;
extern BOOL bWordWrap;
extern BOOL bWordWrapG;
extern int iWordWrapMode;
extern int iLongLinesLimit;
extern int iLongLinesLimitG;
@ -6519,10 +6505,10 @@ BOOL FileVars_Apply(HWND hwnd,LPFILEVARS lpfv) {
SendMessage(hwndEdit,SCI_SETTABINDENTS,bTabIndents,0);
if (lpfv->mask & FV_WORDWRAP)
fWordWrap = lpfv->fWordWrap;
bWordWrap = lpfv->fWordWrap;
else
fWordWrap = fWordWrapG;
if (!fWordWrap)
bWordWrap = bWordWrapG;
if (!bWordWrap)
SendMessage(hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);

View File

@ -41,6 +41,7 @@
extern HINSTANCE g_hInstance;
extern BOOL bSkipUnicodeDetection;
extern BOOL bPreserveCaretPos;
//=============================================================================
@ -167,10 +168,11 @@ UINT IniSectionGetUInt(
return(uDefault);
}
BOOL IniSectionSetString(LPWSTR lpCachedIniSection,LPCWSTR lpName,LPCWSTR lpString)
{
WCHAR tch[32+512*3+32];
WCHAR *p = lpCachedIniSection;
WCHAR* p = lpCachedIniSection;
if (p) {
while (*p) {
@ -1764,7 +1766,7 @@ BOOL MRU_Add(LPMRULIST pmru,LPCWSTR pszNew, int iEnc, int iPos)
pmru->pszItems[0] = StrDup(pszNew);
pmru->iEncoding[0] = iEnc;
pmru->iCaretPos[0] = iPos;
pmru->iCaretPos[0] = (bPreserveCaretPos) ? iPos : 0;
return TRUE;
}
@ -1816,7 +1818,7 @@ BOOL MRU_AddFile(LPMRULIST pmru,LPCWSTR pszFile,BOOL bRelativePath,BOOL bUnexpan
pmru->pszItems[0] = StrDup(pszFile);
}
pmru->iEncoding[0] = iEnc;
pmru->iCaretPos[0] = iPos;
pmru->iCaretPos[0] = (bPreserveCaretPos) ? iPos : 0;
return TRUE;
}
@ -1836,6 +1838,8 @@ BOOL MRU_Delete(LPMRULIST pmru,int iIndex) {
pmru->iCaretPos[i] = pmru->iCaretPos[i + 1];
pmru->pszItems[i+1] = NULL;
pmru->iEncoding[i+1] = 0;
pmru->iCaretPos[i+1] = 0;
}
return TRUE;
}
@ -1921,7 +1925,7 @@ BOOL MRU_Load(LPMRULIST pmru) {
int iCP = IniSectionGetInt(pIniSection,tchName,0);
pmru->iEncoding[n] = Encoding_MapIniSetting(TRUE,iCP);
StringCchPrintf(tchName,COUNTOF(tchName),L"POS%.2i",i + 1);
pmru->iCaretPos[n] = IniSectionGetInt(pIniSection,tchName,0);
pmru->iCaretPos[n] = (bPreserveCaretPos) ? IniSectionGetInt(pIniSection,tchName,0) : 0;
++n;
}
}

View File

@ -40,20 +40,28 @@ extern WCHAR szIniFile[MAX_PATH];
WritePrivateProfileString(lpSection,lpName,lpString,szIniFile)
#define IniDeleteSection(lpSection) \
WritePrivateProfileSection(lpSection,NULL,szIniFile)
__inline BOOL IniSetInt(LPCWSTR lpSection,LPCWSTR lpName,int i) {
WCHAR tch[32]={L'\0'}; StringCchPrintf(tch,COUNTOF(tch),L"%i",i); return IniSetString(lpSection,lpName,tch);
__inline BOOL IniSetInt(LPCWSTR lpSection, LPCWSTR lpName, int i)
{
WCHAR tch[32] = { L'\0' }; StringCchPrintf(tch, COUNTOF(tch), L"%i", i); return IniSetString(lpSection, lpName, tch);
}
#define LoadIniSection(lpSection,lpBuf,cchBuf) \
GetPrivateProfileSection(lpSection,lpBuf,cchBuf,szIniFile)
#define SaveIniSection(lpSection,lpBuf) \
WritePrivateProfileSection(lpSection,lpBuf,szIniFile)
int IniSectionGetString(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,int);
int IniSectionGetInt(LPCWSTR,LPCWSTR,int);
UINT IniSectionGetUInt(LPCWSTR,LPCWSTR,UINT);
int IniSectionGetString(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, int);
int IniSectionGetInt(LPCWSTR, LPCWSTR, int);
UINT IniSectionGetUInt(LPCWSTR, LPCWSTR, UINT);
__inline BOOL IniSectionGetBool(LPCWSTR lpCachedIniSection, LPCWSTR lpName, BOOL bDefault) {
return (IniSectionGetInt(lpCachedIniSection, lpName, (bDefault ? 1 : 0)) ? TRUE : FALSE);
}
BOOL IniSectionSetString(LPWSTR,LPCWSTR,LPCWSTR);
__inline BOOL IniSectionSetInt(LPWSTR lpCachedIniSection,LPCWSTR lpName,int i) {
WCHAR tch[32]={L'\0'}; StringCchPrintf(tch,COUNTOF(tch),L"%i",i); return IniSectionSetString(lpCachedIniSection,lpName,tch);
}
__inline BOOL IniSectionSetBool(LPWSTR lpCachedIniSection, LPCWSTR lpName, BOOL b)
{
return IniSectionSetInt(lpCachedIniSection, lpName, (b ? 1 : 0));
}
//extern HWND hwndEdit;

View File

@ -106,6 +106,7 @@ WCHAR szBufferFile[MAX_PATH] = { L'\0' };
BOOL bSaveSettings;
BOOL bEnableSaveSettings;
BOOL bSaveRecentFiles;
BOOL bPreserveCaretPos;
BOOL bSaveFindReplace;
WCHAR tchLastSaveCopyDir[MAX_PATH] = { L'\0' };
WCHAR tchOpenWithDir[MAX_PATH] = { L'\0' };
@ -119,8 +120,8 @@ WCHAR tchToolbarBitmapHot[MAX_PATH] = { L'\0' };
WCHAR tchToolbarBitmapDisabled[MAX_PATH] = { L'\0' };
int iPathNameFormat;
BOOL fWordWrap;
BOOL fWordWrapG;
BOOL bWordWrap;
BOOL bWordWrapG;
int iWordWrapMode;
int iWordWrapIndent;
int iWordWrapSymbols;
@ -1327,7 +1328,7 @@ LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam)
Style_SetIndentGuides(hwndEdit,bShowIndentGuides);
// Word wrap
if (!fWordWrap)
if (!bWordWrap)
SendMessage(hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
@ -1718,6 +1719,7 @@ void MsgEndSession(HWND hwnd, UINT umsg)
}
else
MRU_MergeSave(pFileMRU, TRUE, flagRelativeFileMRU, flagPortableMyDocs);
MRU_Destroy(pFileMRU);
if (!bSaveFindReplace) {
@ -2359,7 +2361,7 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
CheckCmd(hmenu,IDM_VIEW_USE2NDDEFAULT,Style_GetUse2ndDefault(hwndEdit));
CheckCmd(hmenu,IDM_VIEW_WORDWRAP,fWordWrap);
CheckCmd(hmenu,IDM_VIEW_WORDWRAP,bWordWrap);
CheckCmd(hmenu,IDM_VIEW_LONGLINEMARKER,bMarkLongLines);
CheckCmd(hmenu,IDM_VIEW_TABSASSPACES,bTabsAsSpaces);
CheckCmd(hmenu,IDM_VIEW_SHOWINDENTGUIDES,bShowIndentGuides);
@ -2410,6 +2412,8 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
EnableCmd(hmenu,IDM_VIEW_TRANSPARENT,bTransparentModeAvailable);
CheckCmd(hmenu,IDM_VIEW_NOSAVERECENT,bSaveRecentFiles);
CheckCmd(hmenu,IDM_VIEW_NOPRESERVECARET, bPreserveCaretPos);
CheckCmd(hmenu,IDM_VIEW_NOSAVEFINDREPL,bSaveFindReplace);
CheckCmd(hmenu,IDM_VIEW_SAVEBEFORERUNNINGTOOLS,bSaveBeforeRunningTools);
@ -2440,6 +2444,7 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
EnableCmd(hmenu,IDM_VIEW_STICKYWINPOS,i);
EnableCmd(hmenu,IDM_VIEW_SINGLEFILEINSTANCE,i);
EnableCmd(hmenu,IDM_VIEW_NOSAVERECENT,i);
EnableCmd(hmenu,IDM_VIEW_NOPRESERVECARET,i);
EnableCmd(hmenu,IDM_VIEW_NOSAVEFINDREPL,i);
EnableCmd(hmenu,IDM_VIEW_SAVESETTINGS,bEnableSaveSettings && i);
@ -4064,12 +4069,12 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
case IDM_VIEW_WORDWRAP:
fWordWrap = (fWordWrap) ? FALSE : TRUE;
if (!fWordWrap)
bWordWrap = (bWordWrap) ? FALSE : TRUE;
if (!bWordWrap)
SendMessage(hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
fWordWrapG = fWordWrap;
bWordWrapG = bWordWrap;
UpdateToolbar();
break;
@ -4077,7 +4082,7 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
case IDM_VIEW_WORDWRAPSETTINGS:
if (WordWrapSettingsDlg(hwnd,IDD_WORDWRAP,&iWordWrapIndent))
{
if (fWordWrap)
if (bWordWrap)
SendMessage(hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
if (iWordWrapIndent == 5)
SendMessage(hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_SAME,0);
@ -4498,6 +4503,9 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
bSaveRecentFiles = (bSaveRecentFiles) ? FALSE : TRUE;
break;
case IDM_VIEW_NOPRESERVECARET:
bPreserveCaretPos = (bPreserveCaretPos) ? FALSE : TRUE;
break;
case IDM_VIEW_NOSAVEFINDREPL:
bSaveFindReplace = (bSaveFindReplace) ? FALSE : TRUE;
@ -5788,29 +5796,23 @@ void LoadSettings()
LoadIniSection(L"Settings",pIniSection,cchIniSection);
bEnableSaveSettings = TRUE;
bSaveSettings = IniSectionGetInt(pIniSection,L"SaveSettings",1);
if (bSaveSettings) bSaveSettings = 1;
bSaveSettings = IniSectionGetBool(pIniSection,L"SaveSettings",TRUE);
bSaveRecentFiles = IniSectionGetInt(pIniSection,L"SaveRecentFiles",0);
if (bSaveRecentFiles) bSaveRecentFiles = 1;
bSaveRecentFiles = IniSectionGetBool(pIniSection,L"SaveRecentFiles",FALSE);
bPreserveCaretPos = IniSectionGetBool(pIniSection, L"PreserveCaretPos",FALSE);
bSaveFindReplace = IniSectionGetInt(pIniSection,L"SaveFindReplace",0);
if (bSaveFindReplace) bSaveFindReplace = 1;
bSaveFindReplace = IniSectionGetBool(pIniSection,L"SaveFindReplace",FALSE);
efrData.bFindClose = IniSectionGetInt(pIniSection,L"CloseFind",0);
if (efrData.bFindClose) efrData.bReplaceClose = TRUE;
efrData.bFindClose = IniSectionGetBool(pIniSection,L"CloseFind", FALSE);
efrData.bReplaceClose = IniSectionGetInt(pIniSection,L"CloseReplace",0);
if (efrData.bReplaceClose) efrData.bReplaceClose = TRUE;
efrData.bReplaceClose = IniSectionGetBool(pIniSection,L"CloseReplace", FALSE);
efrData.bNoFindWrap = IniSectionGetInt(pIniSection,L"NoFindWrap",0);
if (efrData.bNoFindWrap) efrData.bNoFindWrap = TRUE;
efrData.bNoFindWrap = IniSectionGetBool(pIniSection,L"NoFindWrap", FALSE);
efrData.bTransformBS = IniSectionGetInt(pIniSection,L"FindTransformBS",0);
if (efrData.bTransformBS) efrData.bTransformBS = TRUE;
efrData.bTransformBS = IniSectionGetBool(pIniSection,L"FindTransformBS", FALSE);
efrData.bWildcardSearch = IniSectionGetInt(pIniSection,L"WildcardSearch",0);
if (efrData.bWildcardSearch) efrData.bWildcardSearch = TRUE;
efrData.bWildcardSearch = IniSectionGetBool(pIniSection,L"WildcardSearch",FALSE);
efrData.fuFlags = IniSectionGetUInt(pIniSection, L"efrData_fuFlags", 0);
@ -5829,9 +5831,8 @@ void LoadSettings()
iPathNameFormat = IniSectionGetInt(pIniSection,L"PathNameFormat",0);
iPathNameFormat = max(min(iPathNameFormat,2),0);
fWordWrap = IniSectionGetInt(pIniSection,L"WordWrap",0);
if (fWordWrap) fWordWrap = 1;
fWordWrapG = fWordWrap;
bWordWrap = IniSectionGetBool(pIniSection,L"WordWrap",FALSE);
bWordWrapG = bWordWrap;
iWordWrapMode = IniSectionGetInt(pIniSection,L"WordWrapMode",0);
iWordWrapMode = max(min(iWordWrapMode,1),0);
@ -5842,43 +5843,31 @@ void LoadSettings()
iWordWrapSymbols = IniSectionGetInt(pIniSection,L"WordWrapSymbols",22);
iWordWrapSymbols = max(min(iWordWrapSymbols%10,2),0)+max(min((iWordWrapSymbols%100-iWordWrapSymbols%10)/10,2),0)*10;
bShowWordWrapSymbols = IniSectionGetInt(pIniSection,L"ShowWordWrapSymbols",0);
if (bShowWordWrapSymbols) bShowWordWrapSymbols = 1;
bShowWordWrapSymbols = IniSectionGetBool(pIniSection,L"ShowWordWrapSymbols",0);
bMatchBraces = IniSectionGetInt(pIniSection,L"MatchBraces",1);
if (bMatchBraces) bMatchBraces = 1;
bMatchBraces = IniSectionGetBool(pIniSection,L"MatchBraces",TRUE);
bAutoCloseTags = IniSectionGetInt(pIniSection,L"AutoCloseTags",0);
if (bAutoCloseTags) bAutoCloseTags = 1;
bAutoCloseTags = IniSectionGetBool(pIniSection,L"AutoCloseTags",FALSE);
bHiliteCurrentLine = IniSectionGetInt(pIniSection,L"HighlightCurrentLine",0);
if (bHiliteCurrentLine) bHiliteCurrentLine = 1;
bHiliteCurrentLine = IniSectionGetBool(pIniSection,L"HighlightCurrentLine",FALSE);
bAutoIndent = IniSectionGetInt(pIniSection,L"AutoIndent",1);
if (bAutoIndent) bAutoIndent = 1;
bAutoIndent = IniSectionGetBool(pIniSection,L"AutoIndent",TRUE);
bAutoCompleteWords = IniSectionGetInt(pIniSection,L"AutoCompleteWords",0);
if (bAutoCompleteWords) bAutoCompleteWords = 1;
bAutoCompleteWords = IniSectionGetBool(pIniSection,L"AutoCompleteWords",FALSE);
bAccelWordNavigation = IniSectionGetInt(pIniSection, L"AccelWordNavigation", 0);
if (bAccelWordNavigation) bAccelWordNavigation = 1;
bAccelWordNavigation = IniSectionGetBool(pIniSection, L"AccelWordNavigation", FALSE);
bVirtualSpaceInRectSelection = IniSectionGetInt(pIniSection,L"VirtualSpaceInRectSelection",0);
if (bVirtualSpaceInRectSelection) bVirtualSpaceInRectSelection = 1;
bVirtualSpaceInRectSelection = IniSectionGetBool(pIniSection,L"VirtualSpaceInRectSelection",FALSE);
bShowIndentGuides = IniSectionGetInt(pIniSection,L"ShowIndentGuides",0);
if (bShowIndentGuides) bShowIndentGuides = 1;
bShowIndentGuides = IniSectionGetBool(pIniSection,L"ShowIndentGuides",FALSE);
bTabsAsSpaces = IniSectionGetInt(pIniSection,L"TabsAsSpaces",1);
if (bTabsAsSpaces) bTabsAsSpaces = 1;
bTabsAsSpaces = IniSectionGetBool(pIniSection,L"TabsAsSpaces",TRUE);
bTabsAsSpacesG = bTabsAsSpaces;
bTabIndents = IniSectionGetInt(pIniSection,L"TabIndents",1);
if (bTabIndents) bTabIndents = 1;
bTabIndents = IniSectionGetBool(pIniSection,L"TabIndents",TRUE);
bTabIndentsG = bTabIndents;
bBackspaceUnindents = IniSectionGetInt(pIniSection,L"BackspaceUnindents",0);
if (bBackspaceUnindents) bBackspaceUnindents = 1;
bBackspaceUnindents = IniSectionGetBool(pIniSection,L"BackspaceUnindents",FALSE);
iTabWidth = IniSectionGetInt(pIniSection,L"TabWidth",2);
iTabWidth = max(min(iTabWidth,256),1);
@ -5888,8 +5877,7 @@ void LoadSettings()
iIndentWidth = max(min(iIndentWidth,256),0);
iIndentWidthG = iIndentWidth;
bMarkLongLines = IniSectionGetInt(pIniSection,L"MarkLongLines",0);
if (bMarkLongLines) bMarkLongLines = 1;
bMarkLongLines = IniSectionGetBool(pIniSection,L"MarkLongLines",FALSE);
iLongLinesLimit = IniSectionGetInt(pIniSection,L"LongLinesLimit",72);
iLongLinesLimit = max(min(iLongLinesLimit,4096),0);
@ -5898,50 +5886,39 @@ void LoadSettings()
iLongLineMode = IniSectionGetInt(pIniSection,L"LongLineMode",EDGE_LINE);
iLongLineMode = max(min(iLongLineMode,EDGE_BACKGROUND),EDGE_LINE);
bShowSelectionMargin = IniSectionGetInt(pIniSection,L"ShowSelectionMargin",0);
if (bShowSelectionMargin) bShowSelectionMargin = 1;
bShowSelectionMargin = IniSectionGetBool(pIniSection,L"ShowSelectionMargin",FALSE);
bShowLineNumbers = IniSectionGetInt(pIniSection,L"ShowLineNumbers",1);
if (bShowLineNumbers) bShowLineNumbers = 1;
bShowLineNumbers = IniSectionGetBool(pIniSection,L"ShowLineNumbers", TRUE);
bShowCodeFolding = IniSectionGetInt(pIniSection,L"ShowCodeFolding",1);
if (bShowCodeFolding) bShowCodeFolding = 1;
bShowCodeFolding = IniSectionGetBool(pIniSection,L"ShowCodeFolding", TRUE);
iMarkOccurrences = IniSectionGetInt(pIniSection,L"MarkOccurrences",3);
bMarkOccurrencesMatchCase = IniSectionGetInt(pIniSection,L"MarkOccurrencesMatchCase",0);
bMarkOccurrencesMatchWords = IniSectionGetInt(pIniSection,L"MarkOccurrencesMatchWholeWords",1);
bMarkOccurrencesMatchCase = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchCase",FALSE);
bMarkOccurrencesMatchWords = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchWholeWords",TRUE);
bViewWhiteSpace = IniSectionGetInt(pIniSection,L"ViewWhiteSpace",0);
if (bViewWhiteSpace) bViewWhiteSpace = 1;
bViewWhiteSpace = IniSectionGetBool(pIniSection,L"ViewWhiteSpace", FALSE);
bViewEOLs = IniSectionGetInt(pIniSection,L"ViewEOLs",0);
if (bViewEOLs) bViewEOLs = 1;
bViewEOLs = IniSectionGetBool(pIniSection,L"ViewEOLs", FALSE);
iDefaultEncoding = IniSectionGetInt(pIniSection,L"DefaultEncoding", CPI_NONE);
// if DefaultEncoding is not defined set to system's current code-page
iDefaultEncoding = (iDefaultEncoding == CPI_NONE) ?
Encoding_MapIniSetting(TRUE,(int)GetACP()) : Encoding_MapIniSetting(TRUE,iDefaultEncoding);
bSkipUnicodeDetection = IniSectionGetInt(pIniSection, L"SkipUnicodeDetection", 0);
if (bSkipUnicodeDetection) bSkipUnicodeDetection = 1;
bSkipUnicodeDetection = IniSectionGetBool(pIniSection, L"SkipUnicodeDetection", FALSE);
bLoadASCIIasUTF8 = IniSectionGetInt(pIniSection, L"LoadASCIIasUTF8", 0);
if (bLoadASCIIasUTF8) bLoadASCIIasUTF8 = 1;
bLoadASCIIasUTF8 = IniSectionGetBool(pIniSection, L"LoadASCIIasUTF8", FALSE);
bLoadNFOasOEM = IniSectionGetInt(pIniSection,L"LoadNFOasOEM",1);
if (bLoadNFOasOEM) bLoadNFOasOEM = 1;
bLoadNFOasOEM = IniSectionGetBool(pIniSection,L"LoadNFOasOEM",TRUE);
bNoEncodingTags = IniSectionGetInt(pIniSection,L"NoEncodingTags",0);
if (bNoEncodingTags) bNoEncodingTags = 1;
bNoEncodingTags = IniSectionGetBool(pIniSection,L"NoEncodingTags", FALSE);
iDefaultEOLMode = IniSectionGetInt(pIniSection,L"DefaultEOLMode",0);
iDefaultEOLMode = max(min(iDefaultEOLMode,2),0);
bFixLineEndings = IniSectionGetInt(pIniSection,L"FixLineEndings",1);
if (bFixLineEndings) bFixLineEndings = 1;
bFixLineEndings = IniSectionGetBool(pIniSection,L"FixLineEndings",TRUE);
bAutoStripBlanks = IniSectionGetInt(pIniSection,L"FixTrailingBlanks",0);
if (bAutoStripBlanks) bAutoStripBlanks = 1;
bAutoStripBlanks = IniSectionGetBool(pIniSection,L"FixTrailingBlanks",FALSE);
iPrintHeader = IniSectionGetInt(pIniSection,L"PrintHeader",1);
iPrintHeader = max(min(iPrintHeader,3),0);
@ -5967,39 +5944,32 @@ void LoadSettings()
pagesetupMargin.bottom = IniSectionGetInt(pIniSection,L"PrintMarginBottom",-1);
pagesetupMargin.bottom = max(pagesetupMargin.bottom,-1);
bSaveBeforeRunningTools = IniSectionGetInt(pIniSection,L"SaveBeforeRunningTools",0);
if (bSaveBeforeRunningTools) bSaveBeforeRunningTools = 1;
bSaveBeforeRunningTools = IniSectionGetBool(pIniSection,L"SaveBeforeRunningTools",FALSE);
iFileWatchingMode = IniSectionGetInt(pIniSection,L"FileWatchingMode",0);
iFileWatchingMode = max(min(iFileWatchingMode,2),0);
bResetFileWatching = IniSectionGetInt(pIniSection,L"ResetFileWatching",1);
if (bResetFileWatching) bResetFileWatching = 1;
bResetFileWatching = IniSectionGetBool(pIniSection,L"ResetFileWatching",TRUE);
iEscFunction = IniSectionGetInt(pIniSection,L"EscFunction",0);
iEscFunction = max(min(iEscFunction,2),0);
bAlwaysOnTop = IniSectionGetInt(pIniSection,L"AlwaysOnTop",0);
if (bAlwaysOnTop) bAlwaysOnTop = 1;
bAlwaysOnTop = IniSectionGetBool(pIniSection,L"AlwaysOnTop",FALSE);
bMinimizeToTray = IniSectionGetInt(pIniSection,L"MinimizeToTray",0);
if (bMinimizeToTray) bMinimizeToTray = 1;
bMinimizeToTray = IniSectionGetBool(pIniSection,L"MinimizeToTray",FALSE);
bTransparentMode = IniSectionGetInt(pIniSection,L"TransparentMode",0);
if (bTransparentMode) bTransparentMode = 1;
bTransparentMode = IniSectionGetBool(pIniSection,L"TransparentMode",FALSE);
// Check if SetLayeredWindowAttributes() is available
bTransparentModeAvailable =
(GetProcAddress(GetModuleHandle(L"User32"),"SetLayeredWindowAttributes") != NULL);
bTransparentModeAvailable = (bTransparentModeAvailable) ? TRUE : FALSE;
IniSectionGetString(pIniSection,L"ToolbarButtons",L"",
tchToolbarButtons,COUNTOF(tchToolbarButtons));
IniSectionGetString(pIniSection,L"ToolbarButtons",L"",tchToolbarButtons,COUNTOF(tchToolbarButtons));
bShowToolbar = IniSectionGetInt(pIniSection,L"ShowToolbar",1);
if (bShowToolbar) bShowToolbar = 1;
bShowToolbar = IniSectionGetBool(pIniSection,L"ShowToolbar",TRUE);
bShowStatusbar = IniSectionGetInt(pIniSection,L"ShowStatusbar",1);
if (bShowStatusbar) bShowStatusbar = 1;
bShowStatusbar = IniSectionGetBool(pIniSection,L"ShowStatusbar",TRUE);
cxEncodingDlg = IniSectionGetInt(pIniSection,L"EncodingDlgSizeX",256);
cxEncodingDlg = max(cxEncodingDlg,0);
@ -6177,6 +6147,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
IniSectionSetInt(pIniSection, L"SaveSettings", bSaveSettings);
IniSectionSetInt(pIniSection, L"SaveRecentFiles", bSaveRecentFiles);
IniSectionSetInt(pIniSection, L"PreserveCaretPos", bPreserveCaretPos);
IniSectionSetInt(pIniSection, L"SaveFindReplace", bSaveFindReplace);
IniSectionSetInt(pIniSection, L"CloseFind", efrData.bFindClose);
IniSectionSetInt(pIniSection, L"CloseReplace", efrData.bReplaceClose);
@ -6189,7 +6160,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
PathRelativeToApp(tchFavoritesDir, wchTmp, COUNTOF(wchTmp), FALSE, TRUE, flagPortableMyDocs);
IniSectionSetString(pIniSection, L"Favorites", wchTmp);
IniSectionSetInt(pIniSection, L"PathNameFormat", iPathNameFormat);
IniSectionSetInt(pIniSection, L"WordWrap", fWordWrapG);
IniSectionSetInt(pIniSection, L"WordWrap", bWordWrapG);
IniSectionSetInt(pIniSection, L"WordWrapMode", iWordWrapMode);
IniSectionSetInt(pIniSection, L"WordWrapIndent", iWordWrapIndent);
IniSectionSetInt(pIniSection, L"WordWrapSymbols", iWordWrapSymbols);
@ -7007,7 +6978,7 @@ void UpdateToolbar()
EnableTool(IDT_FILE_SAVE, (bModified || Encoding_HasChanged(CPI_GET)) /*&& !bReadOnly*/);
CheckTool(IDT_VIEW_WORDWRAP,fWordWrap);
CheckTool(IDT_VIEW_WORDWRAP,bWordWrap);
}
@ -7385,7 +7356,7 @@ BOOL FileIO(BOOL fLoad,LPCWSTR pszFileName,BOOL bNoEncDetect,int *ienc,int *ieol
int idx;
if (MRU_FindFile(pFileMRU,pszFileName,&idx)) {
pFileMRU->iEncoding[idx] = *ienc;
pFileMRU->iCaretPos[idx] = (int)SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0);
pFileMRU->iCaretPos[idx] = (bPreserveCaretPos) ? (int)SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0) : 0;
}
fSuccess = EditSaveFile(hwndEdit,pszFileName,*ienc,pbCancelDataLoss,bSaveCopy);
}
@ -7582,9 +7553,14 @@ BOOL FileLoad(BOOL bDontSave,BOOL bNew,BOOL bReload,BOOL bNoEncDetect,LPCWSTR lp
EditEnsureSelectionVisible(hwndEdit);
}
// set historic caret pos
else if (iCaretPos > 0) {
SendMessage(hwndEdit,SCI_GOTOPOS,(WPARAM)iCaretPos,0);
SendMessage(hwndEdit,SCI_CHOOSECARETX,0,0);
else if (iCaretPos > 0)
{
SendMessage(hwndEdit, SCI_GOTOPOS, (WPARAM)iCaretPos, 0);
// adjust view
int iCurPos = (int)SendMessage(hwndEdit, SCI_GETCURRENTPOS, 0, 0);
int iLine = (int)SendMessage(hwndEdit, SCI_LINEFROMPOSITION, (WPARAM)iCurPos, 0);
int iCol = (int)SendMessage(hwndEdit, SCI_GETCOLUMN, (WPARAM)iCurPos, 0);
EditJumpTo(hwndEdit, iLine+1, iCol+1);
}
}
// consistent settings file handling (if loaded in editor)
@ -7682,7 +7658,7 @@ BOOL FileSave(BOOL bSaveAlways,BOOL bAsk,BOOL bSaveAs,BOOL bSaveCopy)
int idx;
if (MRU_FindFile(pFileMRU,szCurFile,&idx)) {
pFileMRU->iEncoding[idx] = Encoding_Current(CPI_GET);
pFileMRU->iCaretPos[idx] = (int)SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0);
pFileMRU->iCaretPos[idx] = (bPreserveCaretPos) ? (int)SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0) : 0;
}
return TRUE;
}
@ -7771,7 +7747,7 @@ BOOL FileSave(BOOL bSaveAlways,BOOL bAsk,BOOL bSaveAs,BOOL bSaveCopy)
bModified = FALSE;
int iCurrEnc = Encoding_Current(CPI_GET);
Encoding_HasChanged(iCurrEnc);
int iCaretPos = (int)SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0);
int iCaretPos = (int)SendMessage(hwndEdit, SCI_GETCURRENTPOS, 0, 0);
MRU_AddFile(pFileMRU,szCurFile,flagRelativeFileMRU,flagPortableMyDocs,iCurrEnc,iCaretPos);
if (flagUseSystemMRU == 2)
SHAddToRecentDocs(SHARD_PATHW,szCurFile);

Binary file not shown.

View File

@ -1,8 +1,8 @@
//{{NO_DEPENDENCIES}}
// Von Microsoft Visual C++ generierte Includedatei.
// Verwendet durch Notepad3.rc
// Microsoft Visual C++ generated include file.
// Used by Notepad3.rc
//
#define IDR_RT_MANIFEST 1
#define IDR_RT_MANIFEST 1
#define IDR_MAINWND 100
#define IDC_FINDTEXT 100
#define IDC_LINENUM 100
@ -55,6 +55,7 @@
#define IDC_AUTOSTRIPBLANKS 103
#define IDC_ENCODINGFROMFILEVARS 103
#define IDC_WEBPAGE2 103
#define IDC_PRESERVECARET 103
#define IDC_MODWEBPAGE2 104
#define IDD_ENCODING 104
#define IDC_MOD_PAGE2 104
@ -121,6 +122,7 @@
#define IDC_WILDCARDSEARCH 154
#define IDC_SCI_VERSION 155
#define IDR_MAINWND2 156
#define IDC_REMOVE 157
#define IDACC_FIND 200
#define IDACC_REPLACE 201
#define IDACC_SAVEPOS 202
@ -381,6 +383,7 @@
#define IDM_VIEW_AUTOCOMPLETEWORDS 40453
#define IDM_VIEW_ACCELWORDNAV 40454
#define IDM_VIEW_VIRTSPACERECTSEL 40455
#define IDM_VIEW_NOPRESERVECARET 40456
#define IDM_HELP_ABOUT 40500
#define IDM_HELP_CMD 40501
#define IDM_TRAY_RESTORE 40600
@ -462,7 +465,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 600
#define _APS_NEXT_COMMAND_VALUE 700
#define _APS_NEXT_CONTROL_VALUE 800