Merge pull request #3384 from RaiKoHoff/Dev_RC1

Add file/dir exists/not-found to hyperlink tooltip (if file-url)
This commit is contained in:
Rainer Kottenhoff 2021-04-25 13:10:56 +02:00 committed by GitHub
commit d531362881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 214 additions and 168 deletions

View File

@ -242,6 +242,9 @@
#define IDS_MUI_RELOADSETTINGS 15062
#define IDS_MUI_RELOADCFGSEX 15063
#define IDS_MUI_OUT_OFF_OCCMRK 15064
#define IDS_MUI_URL_DIR_EXISTS 15065
#define IDS_MUI_URL_FILE_EXISTS 15066
#define IDS_MUI_URL_PATH_NOT_FOUND 15067
#define IDS_MUI_SB_MARK_ALL_OCC 15500
#define IDS_MUI_SB_TOGGLE_VIEW 15501

View File

@ -196,6 +196,10 @@ BEGIN
IDS_MUI_EXPORT_FAIL "Fehler beim Export der Stil Einstellungen nach ""%s""."
IDS_MUI_REGEX_INVALID "Fehler bei der Evaluierung des regulären Ausdrucks (RegEx), der Ausruck ist ungültig!"
IDS_MUI_DROP_NO_FILE "Es wurde kein gültiger Dateiname erkannt. Falls aus einer 32-bit Applikation gedropped wurde, dann versuche die Datei auf die Werkzeugleiste zu ziehen."
IDS_MUI_URL_DIR_EXISTS "URL spezifiziertes Verzeichnis existiert!"
IDS_MUI_URL_FILE_EXISTS "URL spezifizierte Datei existiert!"
IDS_MUI_URL_PATH_NOT_FOUND
"URL spezifizierter Pfad nicht gefunden!"
IDS_MUI_URL_OPEN_FILE "\nAlt + Click um die Datei zu öffnen."
IDS_MUI_URL_OPEN_BROWSER "\nCtrl + Click um die URL im Browser zu öffnen."
IDS_MUI_INF_PRSVFILEMODTM

View File

@ -196,6 +196,10 @@ BEGIN
IDS_MUI_EXPORT_FAIL "Error exporting style settings to ""%s""."
IDS_MUI_REGEX_INVALID "Error evaluating regular expression. Expression is invalid!"
IDS_MUI_DROP_NO_FILE "No valid filename retrieved.\nIf dropping from 32-bit application,\nplease drag and drop to Notepad3's tool bar."
IDS_MUI_URL_DIR_EXISTS "URL specified directory exists!"
IDS_MUI_URL_FILE_EXISTS "URL specified file exists!"
IDS_MUI_URL_PATH_NOT_FOUND
"URL specified path not found!"
IDS_MUI_URL_OPEN_FILE "\nAlt + Click to open the file."
IDS_MUI_URL_OPEN_BROWSER "\nCtrl + Click to open link in browser."
IDS_MUI_INF_PRSVFILEMODTM

View File

@ -4763,6 +4763,9 @@ void Editor::SetHoverIndicatorPosition(Sci::Position position) {
}
}
if (hoverIndicatorPosPrev != hoverIndicatorPos) {
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
TickFor(TickReason::dwell); // trigger SCN_DWELLSTART
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
Redraw();
}
}

View File

@ -952,7 +952,7 @@ extern "C" bool TestIniFile()
NormalizePathEx(pszIniFilePath, pathBufCount, true, false);
if (!PathFileExists(pszIniFilePath) || PathIsDirectory(pszIniFilePath)) {
if (!PathIsExistingFile(pszIniFilePath)) {
StringCchCopy(Paths.IniFileDefault, COUNTOF(Paths.IniFileDefault), pszIniFilePath);
StringCchCopy(pszIniFilePath, pathBufCount, L"");
return false;
@ -1439,9 +1439,9 @@ void LoadSettings()
GET_BOOL_VALUE_FROM_INISECTION(AutoCloseTags, false);
GET_INT_VALUE_FROM_INISECTION(HighlightCurrentLine, 1, 0, 2);
GET_BOOL_VALUE_FROM_INISECTION(HyperlinkHotspot, true);
GET_BOOL_VALUE_FROM_INISECTION(ShowHypLnkToolTip, false);
GET_INT_VALUE_FROM_INISECTION(ColorDefHotspot, 2, 0, 3);
GET_BOOL_VALUE_FROM_INISECTION(ScrollPastEOF, false);
GET_BOOL_VALUE_FROM_INISECTION(ShowHypLnkToolTip, true);
GET_BOOL_VALUE_FROM_INISECTION(HighlightUnicodePoints, true);
GET_BOOL_VALUE_FROM_INISECTION(AutoIndent, true);

View File

@ -1748,7 +1748,6 @@ void EditSentenceCase(HWND hwnd)
}
//=============================================================================
//
// EditURLEncode()
@ -1783,7 +1782,7 @@ void EditURLEncode(const bool isPathConvert)
return;
}
LPWSTR const pszEscapedW = (LPWSTR)AllocMem(cchEscaped * sizeof(WCHAR), HEAP_ZERO_MEMORY);
LPWSTR const pszEscapedW = (LPWSTR)AllocMem(max_s(cchEscaped, MAX_PATH) * sizeof(WCHAR), HEAP_ZERO_MEMORY);
if (pszEscapedW == NULL) {
FreeMem(pszEscaped);
return;
@ -2876,8 +2875,8 @@ void EditCopyMultiSelection(HWND hwnd) {
//
// EditModifyLines()
//
void EditModifyLines(LPCWSTR pwszPrefix, LPCWSTR pwszAppend)
{
void EditModifyLines(const PENCLOSESELDATA pEnclData) {
if (Sci_IsMultiOrRectangleSelection()) {
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_SELRECTORMULTI);
return;
@ -2891,11 +2890,11 @@ void EditModifyLines(LPCWSTR pwszPrefix, LPCWSTR pwszAppend)
DocPos iSelStart = SciCall_GetSelectionStart();
DocPos iSelEnd = SciCall_GetSelectionEnd();
if (StrIsNotEmpty(pwszPrefix)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pwszPrefix, -1, mszPrefix1, COUNTOF(mszPrefix1), NULL, NULL);
if (StrIsNotEmpty(pEnclData->pwsz1)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pEnclData->pwsz1, -1, mszPrefix1, COUNTOF(mszPrefix1), NULL, NULL);
}
if (StrIsNotEmpty(pwszAppend)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pwszAppend, -1, mszAppend1, COUNTOF(mszAppend1), NULL, NULL);
if (StrIsNotEmpty(pEnclData->pwsz2)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pEnclData->pwsz2, -1, mszAppend1, COUNTOF(mszAppend1), NULL, NULL);
}
DocLn iLineStart = SciCall_LineFromPosition(iSelStart);
@ -3074,7 +3073,7 @@ void EditModifyLines(LPCWSTR pwszPrefix, LPCWSTR pwszAppend)
for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) {
if (StrIsNotEmpty(pwszPrefix)) {
if (StrIsNotEmpty(pEnclData->pwsz1)) {
char mszInsert[512 * 3] = { '\0' };
StringCchCopyA(mszInsert, COUNTOF(mszInsert), mszPrefix1);
@ -3093,7 +3092,7 @@ void EditModifyLines(LPCWSTR pwszPrefix, LPCWSTR pwszAppend)
SciCall_ReplaceTarget(-1, mszInsert);
}
if (StrIsNotEmpty(pwszAppend)) {
if (StrIsNotEmpty(pEnclData->pwsz2)) {
char mszInsert[512 * 3] = { '\0' };
StringCchCopyA(mszInsert, COUNTOF(mszInsert), mszAppend1);
@ -3464,8 +3463,8 @@ void EditAlignText(int nMode)
//
// EditEncloseSelection()
//
void EditEncloseSelection(LPCWSTR pwszOpen, LPCWSTR pwszClose)
{
void EditEncloseSelection(LPCWSTR pszOpen, LPCWSTR pszClose) {
if (Sci_IsMultiOrRectangleSelection()) {
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_SELRECTORMULTI);
return;
@ -3473,18 +3472,18 @@ void EditEncloseSelection(LPCWSTR pwszOpen, LPCWSTR pwszClose)
_SAVE_TARGET_RANGE_;
char mszOpen[256 * 3] = { '\0' };
char mszClose[256 * 3] = { '\0' };
char mszOpen[ENCLDATA_SIZE * 3] = { '\0' };
char mszClose[ENCLDATA_SIZE * 3] = { '\0' };
bool const bStraightSel = (SciCall_GetCurrentPos() >= SciCall_GetAnchor());
DocPos const iSelStart = SciCall_GetSelectionStart();
DocPos const iSelEnd = SciCall_GetSelectionEnd();
if (StrIsNotEmpty(pwszOpen)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pwszOpen, -1, mszOpen, COUNTOF(mszOpen), NULL, NULL);
if (StrIsNotEmpty(pszOpen)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pszOpen, -1, mszOpen, COUNTOF(mszOpen), NULL, NULL);
}
if (StrIsNotEmpty(pwszClose)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pwszClose, -1, mszClose, COUNTOF(mszClose), NULL, NULL);
if (StrIsNotEmpty(pszClose)) {
WideCharToMultiByteEx(Encoding_SciCP, 0, pszClose, -1, mszClose, COUNTOF(mszClose), NULL, NULL);
}
DocPos const iLenOpen = (DocPos)StringCchLenA(mszOpen, COUNTOF(mszOpen));
DocPos const iLenClose = (DocPos)StringCchLenA(mszClose, COUNTOF(mszClose));
@ -8198,15 +8197,10 @@ bool EditLinenumDlg(HWND hwnd)
// Controls: 100 Input
// 101 Input
//
typedef struct _modlinesdata {
LPWSTR pwsz1;
LPWSTR pwsz2;
} MODLINESDATA, *PMODLINESDATA;
static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
static PMODLINESDATA pdata;
static PENCLOSESELDATA pData;
static unsigned id_hover = 0;
static unsigned id_capture = 0;
@ -8249,11 +8243,11 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
if (!hCursorHover) {
hCursorHover = LoadCursor(Globals.hInstance, IDC_ARROW);
}
pdata = (PMODLINESDATA)lParam;
SetDlgItemTextW(hwnd,100,pdata->pwsz1);
SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,255,0);
SetDlgItemTextW(hwnd,101,pdata->pwsz2);
SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0);
pData = (PENCLOSESELDATA)lParam;
SetDlgItemTextW(hwnd,100,pData->pwsz1);
SendDlgItemMessage(hwnd, 100, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0);
SetDlgItemTextW(hwnd,101,pData->pwsz2);
SendDlgItemMessage(hwnd, 101, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0);
CenterDlgInParent(hwnd, NULL);
}
return true;
@ -8410,8 +8404,8 @@ CASE_WM_CTLCOLOR_SET: {
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK: {
GetDlgItemTextW(hwnd,100,pdata->pwsz1,256);
GetDlgItemTextW(hwnd,101,pdata->pwsz2,256);
GetDlgItemTextW(hwnd, 100, pData->pwsz1, ENCLDATA_SIZE);
GetDlgItemTextW(hwnd, 101, pData->pwsz2, ENCLDATA_SIZE);
EndDialog(hwnd,IDOK);
}
break;
@ -8429,20 +8423,16 @@ CASE_WM_CTLCOLOR_SET: {
//
// EditModifyLinesDlg()
//
bool EditModifyLinesDlg(HWND hwnd,LPWSTR pwsz1,LPWSTR pwsz2)
{
bool EditModifyLinesDlg(HWND hwnd, PENCLOSESELDATA pEnclData) {
INT_PTR iResult;
MODLINESDATA data = { 0 };
data.pwsz1 = pwsz1;
data.pwsz2 = pwsz2;
iResult = ThemedDialogBoxParam(
Globals.hLngResContainer,
MAKEINTRESOURCEW(IDD_MUI_MODIFYLINES),
hwnd,
EditModifyLinesDlgProc,
(LPARAM)&data);
Globals.hLngResContainer,
MAKEINTRESOURCEW(IDD_MUI_MODIFYLINES),
hwnd,
EditModifyLinesDlgProc,
(LPARAM)pEnclData);
return (iResult == IDOK) ? true : false;
@ -8575,18 +8565,13 @@ bool EditAlignDlg(HWND hwnd,int *piAlignMode)
// Controls: 100 Input
// 101 Input
//
typedef struct _encloseselectiondata {
LPWSTR pwsz1;
LPWSTR pwsz2;
} ENCLOSESELDATA, *PENCLOSESELDATA;
static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
static PENCLOSESELDATA pdata;
static PENCLOSESELDATA pData;
switch(umsg) {
case WM_INITDIALOG: {
pdata = (PENCLOSESELDATA)lParam;
pData = (PENCLOSESELDATA)lParam;
SetDialogIconNP3(hwnd);
InitWindowCommon(hwnd, true);
@ -8597,10 +8582,10 @@ static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM w
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
}
#endif
SendDlgItemMessage(hwnd, 100, EM_LIMITTEXT, 255, 0);
SetDlgItemTextW(hwnd,100,pdata->pwsz1);
SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0);
SetDlgItemTextW(hwnd,101,pdata->pwsz2);
SendDlgItemMessage(hwnd, 100, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0);
SetDlgItemTextW(hwnd, 100, pData->pwsz1);
SendDlgItemMessage(hwnd, 101, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0);
SetDlgItemTextW(hwnd, 101, pData->pwsz2);
CenterDlgInParent(hwnd, NULL);
}
return TRUE;
@ -8642,8 +8627,8 @@ CASE_WM_CTLCOLOR_SET:
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK: {
GetDlgItemTextW(hwnd,100,pdata->pwsz1,256);
GetDlgItemTextW(hwnd,101,pdata->pwsz2,256);
GetDlgItemTextW(hwnd, 100, pData->pwsz1, ENCLDATA_SIZE);
GetDlgItemTextW(hwnd, 101, pData->pwsz2, ENCLDATA_SIZE);
EndDialog(hwnd,IDOK);
}
break;
@ -8661,20 +8646,16 @@ CASE_WM_CTLCOLOR_SET:
//
// EditEncloseSelectionDlg()
//
bool EditEncloseSelectionDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose)
{
bool EditEncloseSelectionDlg(HWND hwnd, PENCLOSESELDATA pEnclData) {
INT_PTR iResult;
ENCLOSESELDATA data = { 0 };
data.pwsz1 = pwszOpen;
data.pwsz2 = pwszClose;
iResult = ThemedDialogBoxParam(
Globals.hLngResContainer,
MAKEINTRESOURCEW(IDD_MUI_ENCLOSESELECTION),
hwnd,
EditEncloseSelectionDlgProc,
(LPARAM)&data);
Globals.hLngResContainer,
MAKEINTRESOURCEW(IDD_MUI_ENCLOSESELECTION),
hwnd,
EditEncloseSelectionDlgProc,
(LPARAM)pEnclData);
return (iResult == IDOK) ? true : false;
@ -8698,13 +8679,11 @@ typedef struct _tagsdata {
static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
{
static PTAGSDATA pdata;
static WCHAR wchOpenTagStrg[256] = { L'\0' };
static WCHAR wchCloseTagStrg[256] = { L'\0' };
static PTAGSDATA pData;
switch(umsg) {
case WM_INITDIALOG: {
pdata = (PTAGSDATA)lParam;
pData = (PTAGSDATA)lParam;
SetDialogIconNP3(hwnd);
InitWindowCommon(hwnd, true);
@ -8715,20 +8694,20 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,L
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
}
#endif
if (!wchOpenTagStrg[0]) {
StringCchCopy(wchOpenTagStrg, COUNTOF(wchOpenTagStrg), L"<tag>");
if (StrIsEmpty(pData->pwsz1)) {
StringCchCopy(pData->pwsz1, ENCLDATA_SIZE, L"<tag>");
}
if (!wchCloseTagStrg[0]) {
StringCchCopy(wchCloseTagStrg, COUNTOF(wchCloseTagStrg), L"</tag>");
if (StrIsEmpty(pData->pwsz2)) {
StringCchCopy(pData->pwsz2, ENCLDATA_SIZE, L"</tag>");
}
SendDlgItemMessage(hwnd,100,EM_LIMITTEXT, COUNTOF(wchOpenTagStrg)-1,0);
SetDlgItemTextW(hwnd,100, wchOpenTagStrg);
SendDlgItemMessage(hwnd,101,EM_LIMITTEXT, COUNTOF(wchCloseTagStrg)-1,0);
SetDlgItemTextW(hwnd,101, wchCloseTagStrg);
pdata->repeat = 1;
SetDlgItemInt(hwnd, 102, pdata->repeat, FALSE);
SendDlgItemMessage(hwnd, 100, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0);
SetDlgItemTextW(hwnd, 100, pData->pwsz1);
SendDlgItemMessage(hwnd, 101, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0);
SetDlgItemTextW(hwnd, 101, pData->pwsz2);
pData->repeat = 1;
SetDlgItemInt(hwnd, 102, pData->repeat, FALSE);
SetFocus(GetDlgItem(hwnd,100));
PostMessageW(GetDlgItem(hwnd,100),EM_SETSEL,1,(LPARAM)(StringCchLen(wchOpenTagStrg,0)-1));
PostMessageW(GetDlgItem(hwnd, 100), EM_SETSEL, 1, (LPARAM)(StringCchLen(pData->pwsz1, 0) - 1));
CenterDlgInParent(hwnd, NULL);
}
return false;
@ -8772,14 +8751,14 @@ CASE_WM_CTLCOLOR_SET:
case 100: {
if (HIWORD(wParam) == EN_CHANGE) {
bool bClear = true;
GetDlgItemTextW(hwnd,100,wchOpenTagStrg, COUNTOF(wchOpenTagStrg));
if (StringCchLenW(wchOpenTagStrg,COUNTOF(wchOpenTagStrg)) >= 3) {
GetDlgItemTextW(hwnd, 100, pData->pwsz1, ENCLDATA_SIZE);
if (StringCchLenW(pData->pwsz1, ENCLDATA_SIZE) >= 3) {
if (wchOpenTagStrg[0] == L'<') {
WCHAR wchIns[COUNTOF(wchCloseTagStrg)] = { L'\0' };
if ((pData->pwsz1)[0] == L'<') {
WCHAR wchIns[ENCLDATA_SIZE] = { L'\0' };
StringCchCopy(wchIns, COUNTOF(wchIns), L"</");
int cchIns = 2;
const WCHAR* pwCur = &wchOpenTagStrg[1];
const WCHAR *pwCur = &((pData->pwsz1)[1]);
while (
*pwCur &&
*pwCur != L'<' &&
@ -8823,14 +8802,12 @@ CASE_WM_CTLCOLOR_SET:
}
break;
case IDOK: {
GetDlgItemTextW(hwnd, 100, wchOpenTagStrg, COUNTOF(wchOpenTagStrg));
GetDlgItemTextW(hwnd, 101, wchCloseTagStrg, COUNTOF(wchCloseTagStrg));
StringCchCopy(pdata->pwsz1, 256, wchOpenTagStrg);
StringCchCopy(pdata->pwsz2, 256, wchCloseTagStrg);
GetDlgItemTextW(hwnd, 100, pData->pwsz1, ENCLDATA_SIZE);
GetDlgItemTextW(hwnd, 101, pData->pwsz2, ENCLDATA_SIZE);
BOOL fTranslated = FALSE;
UINT const iTimes = GetDlgItemInt(hwnd, 102, &fTranslated, FALSE);
if (fTranslated) {
pdata->repeat = clampu(iTimes, 1, UINT_MAX);
pData->repeat = clampu(iTimes, 1, UINT_MAX);
}
EndDialog(hwnd,IDOK);
}
@ -8849,13 +8826,13 @@ CASE_WM_CTLCOLOR_SET:
//
// EditInsertTagDlg()
//
bool EditInsertTagDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose, UINT* pRepeat)
bool EditInsertTagDlg(HWND hwnd, PENCLOSESELDATA pEnclData, UINT* pRepeat)
{
INT_PTR iResult = 0;
TAGSDATA data = { 0 };
data.pwsz1 = pwszOpen;
data.pwsz2 = pwszClose;
data.pwsz1 = pEnclData->pwsz1;
data.pwsz2 = pEnclData->pwsz2;
data.repeat = 1;
iResult = ThemedDialogBoxParam(

View File

@ -67,10 +67,10 @@ bool EditSetCaretToSelectionStart();
bool EditSetCaretToSelectionEnd();
void EditCutLines(HWND hwnd);
void EditCopyMultiSelection(HWND hwnd);
void EditModifyLines(LPCWSTR pwszPrefix, LPCWSTR pwszAppend);
void EditModifyLines(const PENCLOSESELDATA pEnclData);
void EditIndentBlock(HWND hwnd,int cmd, bool bFormatIndentation, bool bForceAll);
void EditAlignText(int nMode);
void EditEncloseSelection(LPCWSTR pwszOpen,LPCWSTR pwszClose);
void EditEncloseSelection(LPCWSTR pszOpen, LPCWSTR pszClose);
typedef enum _lncmntmode { LNC_TOGGLE, LNC_ADD, LNC_REMOVE } LnCmtMode_t;
void EditToggleLineCommentsSimple(LPCWSTR pwszComment, bool bInsertAtStart, LnCmtMode_t mode);
void EditToggleLineCommentsExtended(LPCWSTR pwszComment, bool bInsertAtStart);
@ -103,9 +103,9 @@ int EditReplaceAllInRange(HWND hwnd, LPEDITFINDREPLACE lpefr, DocPos iStartPos,
bool EditReplaceAll(HWND hwnd, LPEDITFINDREPLACE lpefr, bool);
bool EditReplaceAllInSelection(HWND hwnd, LPEDITFINDREPLACE lpefr, bool);
bool EditLinenumDlg(HWND hwnd);
bool EditModifyLinesDlg(HWND hwnd,LPWSTR pwsz1,LPWSTR pwsz2);
bool EditEncloseSelectionDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose);
bool EditInsertTagDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose,UINT* pRepeat);
bool EditModifyLinesDlg(HWND hwnd, PENCLOSESELDATA pEnclData);
bool EditEncloseSelectionDlg(HWND hwnd, PENCLOSESELDATA pEnclData);
bool EditInsertTagDlg(HWND hwnd, PENCLOSESELDATA pEnclData, UINT *pRepeat);
bool EditSortDlg(HWND hwnd,int* piSortFlags);
bool EditAlignDlg(HWND hwnd,int* piAlignMode);
bool EditPrint(HWND,LPCWSTR,LPCWSTR);

View File

@ -122,11 +122,6 @@ static HWND s_hwndNextCBChain = NULL;
static WCHAR s_wchTmpFilePath[MAX_PATH] = { L'\0' };
static WCHAR s_wchPrefixSelection[256] = { L'\0' };
static WCHAR s_wchAppendSelection[256] = { L'\0' };
static WCHAR s_wchPrefixLines[256] = { L'\0' };
static WCHAR s_wchAppendLines[256] = { L'\0' };
static int s_WinCurrentWidth = 0;
#define FILE_LIST_SIZE 32
@ -1568,7 +1563,7 @@ HWND InitInstance(const HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow)
UpdateToolbar();
UpdateStatusbar(true);
UpdateMarginWidth(true);
UpdateMouseDWellTime();
ResetMouseDWellTime();
// print file immediately and quit
if (Globals.CmdLnFlag_PrintFileAndLeave) {
@ -1977,11 +1972,11 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
SciCall_IndicSetUnder(INDIC_NP3_COLOR_DEF, true);
SciCall_IndicSetAlpha(INDIC_NP3_COLOR_DEF, SC_ALPHA_TRANSPARENT); // reset on hover
SciCall_IndicSetOutlineAlpha(INDIC_NP3_COLOR_DEF, SC_ALPHA_OPAQUE);
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF, INDIC_ROUNDBOX); // Hover
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF, INDIC_HIDDEN); // initially hidden, INDIC_FULLBOX on hover
SciCall_IndicSetHoverFore(INDIC_NP3_COLOR_DEF, RGB(0x00, 0x00, 0x00)); // recalc on hover
SciCall_IndicSetStyle(INDIC_NP3_COLOR_DEF_T, INDIC_HIDDEN); // invisible
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF_T, INDIC_TEXTFORE);
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF_T, INDIC_HIDDEN); // initially hidden, INDIC_TEXTFORE on hover
SciCall_IndicSetHoverFore(INDIC_NP3_COLOR_DEF_T, RGB(0x00, 0x00, 0x00));
SciCall_IndicSetStyle(INDIC_NP3_UNICODE_POINT, INDIC_COMPOSITIONTHIN /*INDIC_HIDDEN*/);
@ -2011,11 +2006,7 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
SciCall_SetCaretSticky(SC_CARETSTICKY_OFF);
//SciCall_SetCaretSticky(SC_CARETSTICKY_WHITESPACE);
if (Settings.ShowHypLnkToolTip || IsColorDefHotspotEnabled()) {
SciCall_SetMouseDWellTime(100);
} else {
SciCall_SetMouseDWellTime(SC_TIME_FOREVER); // default
}
ResetMouseDWellTime();
int const iCaretPolicy = CARET_SLOP | CARET_EVEN | CARET_STRICT;
s_iCaretPolicyV = (Settings2.CurrentLineVerticalSlop > 0) ? iCaretPolicy : CARET_EVEN;
@ -4593,11 +4584,13 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
SciCall_EditToggleOverType();
break;
case IDM_EDIT_ENCLOSESELECTION:
if (EditEncloseSelectionDlg(hwnd,s_wchPrefixSelection,s_wchAppendSelection)) {
EditEncloseSelection(s_wchPrefixSelection,s_wchAppendSelection);
case IDM_EDIT_ENCLOSESELECTION: {
ENCLOSESELDATA data = { 0 };
if (EditEncloseSelectionDlg(hwnd, &data)) {
EditEncloseSelection(data.pwsz1, data.pwsz2);
}
break;
}
break;
case IDM_EDIT_PADWITHSPACES:
@ -4669,11 +4662,13 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
case IDM_EDIT_MODIFYLINES:
if (EditModifyLinesDlg(hwnd,s_wchPrefixLines,s_wchAppendLines)) {
EditModifyLines(s_wchPrefixLines,s_wchAppendLines);
case IDM_EDIT_MODIFYLINES: {
ENCLOSESELDATA data = { 0 };
if (EditModifyLinesDlg(hwnd, &data)) {
EditModifyLines(&data);
}
break;
}
break;
case IDM_EDIT_ALIGN:
@ -4764,12 +4759,11 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_INSERT_TAG: {
WCHAR wszOpen[256] = { L'\0' };
WCHAR wszClose[256] = { L'\0' };
ENCLOSESELDATA data = { 0 };
UINT repeat = 1;
if (EditInsertTagDlg(hwnd, wszOpen, wszClose, &repeat)) {
if (EditInsertTagDlg(hwnd, &data, &repeat)) {
while (repeat > 0) {
EditEncloseSelection(wszOpen, wszClose);
EditEncloseSelection(data.pwsz1, data.pwsz2);
--repeat;
}
}
@ -4868,11 +4862,10 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_STREAMCOMMENT: {
WCHAR cmnt_beg[8] = { L'\0' };
WCHAR cmnt_end[8] = { L'\0' };
Lexer_GetStreamCommentStrgs(cmnt_beg, cmnt_end, COUNTOF(cmnt_beg));
if (StrIsNotEmpty(cmnt_beg)) {
EditEncloseSelection(cmnt_beg, cmnt_end);
ENCLOSESELDATA data = { 0 };
Lexer_GetStreamCommentStrgs(data.pwsz1, data.pwsz2, ENCLDATA_SIZE);
if (StrIsNotEmpty(data.pwsz1)) {
EditEncloseSelection(data.pwsz1, data.pwsz2);
}
}
break;
@ -5450,7 +5443,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_SHOW_HYPLNK_CALLTIP:
Settings.ShowHypLnkToolTip = !Settings.ShowHypLnkToolTip;
UpdateMouseDWellTime();
ResetMouseDWellTime();
break;
case IDM_VIEW_COLORDEFHOTSPOTS:
@ -5459,14 +5452,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_COLOR_BGRA: {
Settings.ColorDefHotspot = iLoWParam - IDM_VIEW_COLORDEFHOTSPOTS;
EditUpdateVisibleIndicators();
UpdateMouseDWellTime();
ResetMouseDWellTime();
}
break;
case IDM_VIEW_UNICODE_POINTS:
Settings.HighlightUnicodePoints = !Settings.HighlightUnicodePoints;
EditUpdateVisibleIndicators();
UpdateMouseDWellTime();
ResetMouseDWellTime();
break;
case IDM_VIEW_ZOOMIN: {
@ -6680,6 +6673,7 @@ static DocPos prevCursorPosition = -1;
// ----------------------------------------------------------------------------
void HandleDWellStartEnd(const DocPos position, const UINT uid)
{
static DocPos prevStartPosition = -1;
@ -6701,6 +6695,7 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
switch (uid) {
case SCN_DWELLSTART: {
if (position < 0) {
SciCall_CallTipCancel();
prevCursorPosition = -1;
@ -6764,29 +6759,70 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
// WebLinks and Color Refs are ASCII only - No need for UTF-8 conversion here
if (INDIC_NP3_HYPERLINK == indicator_id) {
if (!s_bCallTipEscDisabled) {
char chText[MIDSZ_BUFFER] = { '\0' };
// No need for UTF-8 conversion here and
StringCchCopyNA(chText, COUNTOF(chText), SciCall_GetRangePointer(firstPos, length), length);
StrTrimA(chText, " \t\n\r");
if (StrIsEmptyA(chText)) {
break;
const char * const pUrlBegin = SciCall_GetRangePointer(firstPos, length);
char chScheme[32] = { '\0' };
for (unsigned i = 0; i < COUNTOF(chScheme); ++i) {
chScheme[i] = pUrlBegin[i];
if (!pUrlBegin[i] || pUrlBegin[i] == ':') {
break;
}
}
CHAR chCalltipAdd[LARGE_BUFFER] = { L'\0' };
if (StrStrIA(chText, "file:") == chText) {
GetLngStringW2MB(IDS_MUI_URL_OPEN_FILE, chCalltipAdd, COUNTOF(chCalltipAdd));
} else {
GetLngStringW2MB(IDS_MUI_URL_OPEN_BROWSER, chCalltipAdd, COUNTOF(chCalltipAdd));
CHAR chCallTip[MIDSZ_BUFFER] = { L'\0' };
if (StrStrIA(chScheme, "file:") == chScheme) {
WCHAR wchUrl[INTERNET_MAX_URL_LENGTH] = { L'\0' };
WCHAR wchPath[MAX_PATH] = { L'\0' };
int const cchUrl = MultiByteToWideChar(Encoding_SciCP, 0, pUrlBegin, (int)length, wchUrl, COUNTOF(wchUrl));
wchUrl[cchUrl] = L'\0';
StrTrim(wchUrl, L" \r\n\t");
DWORD cchPath = MAX_PATH;
if (FAILED(PathCreateFromUrl(wchUrl, wchPath, &cchPath, 0))) {
const char *p = &pUrlBegin[CONSTSTRGLEN("file://")];
while (p && (*p == '/')) { ++p; }
StringCchCopyN(wchPath, COUNTOF(wchPath), wchUrl, length); // no op
//cchPath = (DWORD)StringCchLen(wchFilePath, MAX_PATH);
}
//NormalizePathEx(wchPath, COUNTOF(wchPath), true, false);
bool found = true;
if (PathIsExistingFile(wchPath)) {
GetLngStringW2MB(IDS_MUI_URL_FILE_EXISTS, chCallTip, (int)(COUNTOF(chCallTip) >> 1));
} else if (PathIsDirectory(wchPath)) {
GetLngStringW2MB(IDS_MUI_URL_DIR_EXISTS, chCallTip, (int)(COUNTOF(chCallTip) >> 1));
} else {
found = false;
GetLngStringW2MB(IDS_MUI_URL_PATH_NOT_FOUND, chCallTip, (int)(COUNTOF(chCallTip) >> 1));
}
if (found) {
size_t cch = StringCchLenA(chCallTip, COUNTOF(chCallTip));
GetLngStringW2MB(IDS_MUI_URL_OPEN_FILE, &(chCallTip[cch]), (int)(COUNTOF(chCallTip) - cch));
}
} else { // Web URL
StringCchCopyNA(chCallTip, COUNTOF(chCallTip) >> 1, pUrlBegin, length);
size_t const cch = StringCchLenA(chCallTip, COUNTOF(chCallTip) >> 1);
GetLngStringW2MB(IDS_MUI_URL_OPEN_BROWSER, &(chCallTip[cch]), (int)(COUNTOF(chCallTip) - cch));
}
if (!StrIsEmptyA(chCallTip)) {
//SciCall_CallTipSetPosition(true);
SciCall_CallTipShow(position, chCallTip);
SciCall_CallTipSetHlt(0, (int)length);
}
char chCallTip[HUGE_BUFFER] = { '\0' };
StringCchCatA(chCallTip, COUNTOF(chCallTip), chText);
StringCchCatA(chCallTip, COUNTOF(chCallTip), chCalltipAdd);
//SciCall_CallTipSetPosition(true);
SciCall_CallTipShow(position, chCallTip);
SciCall_CallTipSetHlt(0, (int)length);
}
} else if (INDIC_NP3_COLOR_DEF == indicator_id) {
char chText[MICRO_BUFFER] = { '\0' };
// Color Refs are ASCII only - No need for UTF-8 conversion here
StringCchCopyNA(chText, COUNTOF(chText), SciCall_GetRangePointer(firstPos, length), length);
@ -6824,8 +6860,14 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
SciCall_IndicSetAlpha(INDIC_NP3_COLOR_DEF, Sci_ClampAlpha(alpha));
SciCall_IndicSetHoverFore(INDIC_NP3_COLOR_DEF, rgb);
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF, INDIC_FULLBOX);
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF_T, INDIC_TEXTFORE);
}
} else if (INDIC_NP3_UNICODE_POINT == indicator_id) {
if (!s_bCallTipEscDisabled) {
char chHex2Char[MIDSZ_BUFFER] = {'\0'};
// No need for UTF-8 conversion here and
@ -6867,11 +6909,14 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
SciCall_SetIndicatorCurrent(INDIC_NP3_COLOR_DEF_T);
SciCall_IndicatorClearRange(0, Sci_GetDocEndPosition());
// destroy rectangualr selection on multi-replace ???
// !!! strange side-effects by following statements !!!
// hide color of color definition
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF, INDIC_HIDDEN); // hide box
SciCall_IndicSetHoverStyle(INDIC_NP3_COLOR_DEF_T, INDIC_HIDDEN); // hide txt
//~ this will destroy rectangular selection on multi-replace ???
//~ !!! strange side-effects using following statements !!!
//~~~SciCall_IndicSetAlpha(INDIC_NP3_COLOR_DEF, SC_ALPHA_TRANSPARENT);
//~~~SciCall_IndicSetFore(INDIC_NP3_COLOR_DEF, RGB(0,0,0));
}
break;
@ -6905,14 +6950,14 @@ bool HandleHotSpotURLClicked(const DocPos position, const HYPERLINK_OPS operatio
return false;
}
const char *pszText = (const char *)SciCall_GetRangePointer(firstPos, length);
const char * const pszText = SciCall_GetRangePointer(firstPos, length);
WCHAR szTextW[INTERNET_MAX_URL_LENGTH + 1];
ptrdiff_t const cchTextW = MultiByteToWideChar(Encoding_SciCP, 0, pszText, (int)length, szTextW, COUNTOF(szTextW));
szTextW[cchTextW] = L'\0';
StrTrim(szTextW, L" \r\n\t");
const WCHAR *chkPreFix = L"file://";
const WCHAR* const chkPreFix = L"file://";
size_t const lenPfx = StringCchLenW(chkPreFix, 0);
if (operation & SELECT_HYPERLINK) {
@ -6944,17 +6989,19 @@ bool HandleHotSpotURLClicked(const DocPos position, const HYPERLINK_OPS operatio
PathCreateFromUrl(szTextW, szUnEscW, &dCch, 0);
szUnEscW[min_u(MAX_PATH, INTERNET_MAX_URL_LENGTH)] = L'\0'; // limit length
WCHAR *const szFileName = szUnEscW;
WCHAR * const szFileName = szUnEscW;
StrTrim(szFileName, L"/");
PathCanonicalizeEx(szFileName, (DWORD)(COUNTOF(szUnEscW) - lenPfx));
if (PathIsDirectory(szFileName)) {
if (PathIsExistingFile(szFileName)) {
FileLoad(szFileName, false, false, false, Settings.SkipUnicodeDetection, Settings.SkipANSICodePageDetection, false);
}
else if (PathIsDirectory(szFileName)) {
WCHAR tchFile[MAX_PATH] = { L'\0' };
if (OpenFileDlg(Globals.hwndMain, tchFile, COUNTOF(tchFile), szFileName)) {
FileLoad(tchFile, false, false, false, Settings.SkipUnicodeDetection, Settings.SkipANSICodePageDetection, false);
}
} else {
FileLoad(szFileName, false, false, false, Settings.SkipUnicodeDetection, Settings.SkipANSICodePageDetection, false);
}
bHandled = true;
@ -6966,7 +7013,7 @@ bool HandleHotSpotURLClicked(const DocPos position, const HYPERLINK_OPS operatio
// ShellExecuteEx() will handle file-system path correctly for "file://" protocol
StringCchCopy(szUnEscW, COUNTOF(szUnEscW), chkPreFix);
dCch -= (DWORD)lenPfx;
PathCreateFromUrl(szTextW, &(szUnEscW[lenPfx]), &dCch, 0);
PathCreateFromUrl(szTextW, &szUnEscW[lenPfx], &dCch, 0);
} else {
UrlUnescapeEx(szTextW, szUnEscW, &dCch);
}
@ -10108,7 +10155,7 @@ bool DoElevatedRelaunch(EditFileIOStatus* pFioStatus, bool bAutoSaveOnRelaunch)
SetSavePoint();
} else {
Globals.dwLastError = GetLastError();
if (PathFileExists(szTempFileName)) {
if (PathIsExistingFile(szTempFileName)) {
DeleteFile(szTempFileName);
}
Flags.bDoRelaunchElevated = false;
@ -10915,12 +10962,12 @@ void SetNotifyIconTitle(HWND hwnd)
//=============================================================================
//
// UpdateMouseDWellTime()
// ResetMouseDWellTime()
//
void UpdateMouseDWellTime()
void ResetMouseDWellTime()
{
if (Settings.ShowHypLnkToolTip || IsColorDefHotspotEnabled() || Settings.HighlightUnicodePoints) {
SciCall_SetMouseDWellTime(100);
SciCall_SetMouseDWellTime(USER_TIMER_MINIMUM << 4);
} else {
Sci_DisableMouseDWellNotification();
}

View File

@ -128,7 +128,7 @@ void UpdateToolbar();
void UpdateStatusbar(const bool bForceRedraw);
void UpdateMarginWidth(const bool bForce);
void UpdateSaveSettingsCmds();
void UpdateMouseDWellTime();
void ResetMouseDWellTime();
void UpdateTitleBar(const HWND hwnd);
void UndoRedoRecordingStart();

View File

@ -317,6 +317,14 @@ typedef enum
// --------------------------------------------------------------------------
#define ENCLDATA_SIZE 256
typedef struct _encloseselectiondata {
WCHAR pwsz1[ENCLDATA_SIZE];
WCHAR pwsz2[ENCLDATA_SIZE];
} ENCLOSESELDATA, *PENCLOSESELDATA;
// --------------------------------------------------------------------------
#define SC_NP3_CURSORHAND 8
//=============================================================================