mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ add: Color hover and picker (HTML color def only #RRGGBB)
This commit is contained in:
parent
d41a89e721
commit
bdaab67697
@ -1 +1 @@
|
||||
2255
|
||||
2256
|
||||
|
||||
@ -606,13 +606,14 @@
|
||||
#define IDM_VIEW_ACCELWORDNAV 40460
|
||||
#define IDM_VIEW_NOPRESERVECARET 40461
|
||||
#define IDM_VIEW_HYPERLINKHOTSPOTS 40462
|
||||
#define IDM_VIEW_CURRENTSCHEME 40463
|
||||
#define IDM_VIEW_SCROLLPASTEOF 40464
|
||||
#define IDM_VIEW_TOGGLE_VIEW 40465
|
||||
#define IDM_VIEW_CHASING_DOCTAIL 40466
|
||||
#define IDM_VIEW_TOGGLETB 40467
|
||||
#define IDM_VIEW_MUTE_MESSAGEBEEP 40468
|
||||
#define IDM_VIEW_SHOW_HYPLNK_CALLTIP 40469
|
||||
#define IDM_VIEW_COLORDEFHOTSPOTS 40463
|
||||
#define IDM_VIEW_CURRENTSCHEME 40464
|
||||
#define IDM_VIEW_SCROLLPASTEOF 40465
|
||||
#define IDM_VIEW_TOGGLE_VIEW 40466
|
||||
#define IDM_VIEW_CHASING_DOCTAIL 40467
|
||||
#define IDM_VIEW_TOGGLETB 40468
|
||||
#define IDM_VIEW_MUTE_MESSAGEBEEP 40469
|
||||
#define IDM_VIEW_SHOW_HYPLNK_CALLTIP 40470
|
||||
|
||||
#define IDM_SET_RENDER_TECH_DEFAULT 40500
|
||||
#define IDM_SET_RENDER_TECH_D2D 40501
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Wys Lyn &Einde\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Skakel &Hotspots\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Visuele Hakie Passing\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Merk Huidi&ge Lyn\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Ïàêàçâàöü &êàí÷àòê³ ðàäêî¢\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Âûçíà÷àöü &ã³ïåðñïàñûëê³\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "Àäçíà÷àöü ïàðíûÿ äó&æê³\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Ïàäñâå÷âàöü àê&òû¢íû ðàäîê\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Zeige Zeilenumbrüche\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "H&yperlink Indikator\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Farb-Definition Indikator", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Zeige passende Klammer\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "A&ktuelle Zeile hervorheben\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Show Line &Endings\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Hyperlink Hotspots\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Colour Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Visual Brace Matching\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "H&ighlight Current Line\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Show Line &Endings\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Hyperlink Hotspots\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Visual Brace Matching\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "H&ighlight Current Line\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Mostrar &fin de línea\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Indicar &hipervínculos\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Visual coincidencia de llave\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "&Resaltar la línea actual\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Afficher les fins de lign&e\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Indicateurs H&yperlink\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "Correspondence &visuelle des accolades\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Mise en b&rillance de la ligne actuelle\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Sorvégek &megjelenítése\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Hivatkoz&ások kiemelése\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Zárójelpár kiemelés\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Akt&uális sor kiemelése\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Mostra simboli di a capo\tCtrl+Shift+0", IDM_VIEW_WORDWRAPSYMBOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Evidenzia h&yperlink\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "Evidenzia &parentesi corrispondente\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Evidenzia riga corrente\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "改行コード(&E)\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "アドレスをリンク(&H)\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "対応括弧を強調表示(&V)\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "現在の行を強調表示(&G)\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -264,6 +264,9 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "다음 선택(&X)\tCtrl+Alt+F2", IDM_EDIT_SELTONEXT
|
||||
MENUITEM "이전 선택(&V)\tCtrl+Alt+Shift+F2", IDM_EDIT_SELTOPREV
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Select &Word or Lines\tCtrl+Spc", IDM_EDIT_SELECTWORD
|
||||
MENUITEM "Multi-Select &All Matches\tCtrl+Shift+Spc", IDM_EDIT_SELECTALLMATCHES
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "책갈피(&K)"
|
||||
@ -300,6 +303,7 @@ BEGIN
|
||||
MENUITEM "줄 끝 표시(&E)\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "하이퍼 링크 핫스팟(&Y)\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "괄호 짝 강조(&V)\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "현재 줄 강조(&G)\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Tonen de lijn &eindes\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "H&yperlink Indicatoren\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Visuele Brace Matching\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Mar&keer actueel lijn\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Pokaż znaki końca wiersza\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Miejsca aktywne hiperpłšczenia\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Wyróżnianie pasujšcych nawiasów\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Wyróżnianie bieżšcego wiersza\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Show Line &Endings\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Hyperlink Hotspots\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "&Visual Brace Matching\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "H&ighlight Current Line\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "Îòîáðàæàòü &îêîí÷àíèÿ ñòðîê\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Îòîáðàæàòü &ãèïåðññûëêè\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "Î&òìå÷àòü ïàðíûå ñêîáêè\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "Ïîäñâå÷èâàòü ò&åêóùóþ ñòðîêó\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -303,6 +303,7 @@ BEGIN
|
||||
MENUITEM "显示换行符号(&E)\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "检测超链接(&Y)\tCtrl+Alt+W", IDM_VIEW_HYPERLINKHOTSPOTS
|
||||
MENUITEM "&Color Definition Hotspots", IDM_VIEW_COLORDEFHOTSPOTS
|
||||
MENUITEM "提示配对括号(&V)\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES
|
||||
POPUP "高亮当前行(&G)\tCtrl+Shift+I"
|
||||
BEGIN
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.614.2255"
|
||||
version="5.19.615.2256"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 Oniguruma</description>
|
||||
|
||||
@ -424,7 +424,10 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int
|
||||
if (inSectionDef) {
|
||||
sc.SetState(SCE_TOML_PARSINGERROR);
|
||||
}
|
||||
else if (inMultiLnString || inMultiLnArrayDef) {
|
||||
else if ((sc.state == SCE_TOML_STR_BASIC) ||
|
||||
(sc.state == SCE_TOML_STR_LITERAL) ||
|
||||
inMultiLnArrayDef)
|
||||
{
|
||||
sc.ForwardSetState(sc.state); // ignore
|
||||
}
|
||||
else {
|
||||
|
||||
@ -796,6 +796,7 @@ 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(ColorDefHotspot, true);
|
||||
GET_BOOL_VALUE_FROM_INISECTION(ScrollPastEOF, false);
|
||||
GET_BOOL_VALUE_FROM_INISECTION(ShowHypLnkToolTip, true);
|
||||
|
||||
@ -1230,6 +1231,7 @@ bool SaveSettings(bool bSaveSettingsNow)
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, AutoCloseTags);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, HighlightCurrentLine);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, HyperlinkHotspot);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ColorDefHotspot);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ScrollPastEOF);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ShowHypLnkToolTip);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, AutoIndent);
|
||||
|
||||
87
src/Edit.c
87
src/Edit.c
@ -6907,56 +6907,68 @@ void EditFinalizeStyling(HWND hwnd, DocPos iEndPos)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditUpdateUrlIndicators()
|
||||
// Find and mark all URL hot-spots
|
||||
// EditUpdateIndicators()
|
||||
// Find and mark all COLOR refs (#RRGGBB)
|
||||
//
|
||||
void EditUpdateUrlIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool bActiveHotspot)
|
||||
static void _ClearIndicatorInRange(const int indicator, const int indicator2nd,
|
||||
const DocPos startPos, const DocPos endPos)
|
||||
{
|
||||
SciCall_SetIndicatorCurrent(indicator);
|
||||
SciCall_IndicatorClearRange(startPos, endPos - startPos);
|
||||
if (indicator2nd >= 0) {
|
||||
SciCall_SetIndicatorCurrent(indicator2nd);
|
||||
SciCall_IndicatorClearRange(startPos, endPos - startPos);
|
||||
}
|
||||
}
|
||||
|
||||
static void _UpdateIndicators(HWND hwnd, const int indicator, const int indicator2nd,
|
||||
const char* regExpr, DocPos startPos, DocPos endPos)
|
||||
{
|
||||
if (endPos < 0) {
|
||||
endPos = Sci_GetDocEndPosition();
|
||||
endPos = Sci_GetDocEndPosition();
|
||||
}
|
||||
else if (endPos < startPos) {
|
||||
swapos(&startPos, &endPos);
|
||||
}
|
||||
if (startPos < 0) { // current line only
|
||||
DocPos const currPos = SciCall_GetCurrentPos();
|
||||
DocLn const lineNo = SciCall_LineFromPosition(currPos);
|
||||
DocLn const lineNo = SciCall_LineFromPosition(SciCall_GetCurrentPos());
|
||||
startPos = SciCall_PositionFromLine(lineNo);
|
||||
endPos = SciCall_GetLineEndPosition(lineNo);
|
||||
}
|
||||
if (endPos == startPos) { return; }
|
||||
else if (endPos == startPos) { return; }
|
||||
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_HYPERLINK);
|
||||
SciCall_IndicatorClearRange(startPos, endPos - startPos);
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_HYPERLINK_U);
|
||||
SciCall_IndicatorClearRange(startPos, endPos - startPos);
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
if (!bActiveHotspot) { return; }
|
||||
|
||||
const char* pszUrlRegEx = "\\b(?:(?:https?|ftp|file)://|www\\.|ftp\\.)"
|
||||
"(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*"
|
||||
"(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#/%=~_|$])";
|
||||
|
||||
int const iRegExLen = (int)StringCchLenA(pszUrlRegEx,0);
|
||||
int const iRegExLen = (int)StringCchLenA(regExpr, 0);
|
||||
|
||||
DocPos start = startPos;
|
||||
DocPos end = endPos;
|
||||
do {
|
||||
|
||||
DocPos const iPos = _FindInTarget(hwnd, pszUrlRegEx, iRegExLen, SCFIND_NP3_REGEX, &start, &end, false, FRMOD_IGNORE);
|
||||
DocPos const _start = start;
|
||||
DocPos const _end = end;
|
||||
DocPos const iPos = _FindInTarget(hwnd, regExpr, iRegExLen, SCFIND_NP3_REGEX, &start, &end, false, FRMOD_IGNORE);
|
||||
|
||||
if (iPos < 0) {
|
||||
break; // not found
|
||||
// not found
|
||||
_ClearIndicatorInRange(indicator, indicator2nd, _start, _end);
|
||||
break;
|
||||
}
|
||||
DocPos const mlen = end - start;
|
||||
if ((mlen <= 0) || (end > endPos)) {
|
||||
// wrong match
|
||||
_ClearIndicatorInRange(indicator, indicator2nd, _start, _end);
|
||||
break; // wrong match
|
||||
}
|
||||
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_HYPERLINK);
|
||||
SciCall_IndicatorFillRange(start, mlen);
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_HYPERLINK_U);
|
||||
_ClearIndicatorInRange(indicator, indicator2nd, _start, end);
|
||||
|
||||
SciCall_SetIndicatorCurrent(indicator);
|
||||
SciCall_IndicatorFillRange(start, mlen);
|
||||
if (indicator2nd >= 0) {
|
||||
SciCall_SetIndicatorCurrent(indicator2nd);
|
||||
SciCall_IndicatorFillRange(start, mlen);
|
||||
}
|
||||
|
||||
// next occurrence
|
||||
start = end + 1;
|
||||
@ -6966,6 +6978,35 @@ void EditUpdateUrlIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool bAc
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditUpdateIndicators()
|
||||
// - Find and mark all URL hot-spots
|
||||
// - Find and mark all COLOR refs (#RRGGBB)
|
||||
//
|
||||
void EditUpdateIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool bClearOnly)
|
||||
{
|
||||
if (bClearOnly) {
|
||||
_ClearIndicatorInRange(INDIC_NP3_HYPERLINK, INDIC_NP3_HYPERLINK_U, startPos, endPos);
|
||||
_ClearIndicatorInRange(INDIC_NP3_COLOR_DEF, INDIC_NP3_COLOR_DWELL, startPos, endPos);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.HyperlinkHotspot)
|
||||
{
|
||||
static const char* pUrlRegEx = "\\b(?:(?:https?|ftp|file)://|www\\.|ftp\\.)"
|
||||
"(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*"
|
||||
"(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#/%=~_|$])";
|
||||
_UpdateIndicators(hwnd, INDIC_NP3_HYPERLINK, INDIC_NP3_HYPERLINK_U, pUrlRegEx, startPos, endPos);
|
||||
}
|
||||
|
||||
if (Settings.ColorDefHotspot)
|
||||
{
|
||||
static const char* pColorRegEx = "#([0-9a-fA-F]){6}";
|
||||
_UpdateIndicators(hwnd, INDIC_NP3_COLOR_DEF, -1, pColorRegEx, startPos, endPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
|
||||
@ -107,7 +107,7 @@ void EditSelectWordAtPos(const DocPos iPos, const bool bForceWord);
|
||||
int EditAddSearchFlags(int flags, bool bRegEx, bool bWordStart, bool bMatchCase, bool bMatchWords, bool bDotMatchAll);
|
||||
void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd);
|
||||
void EditFinalizeStyling(HWND hwnd, DocPos iEndPos);
|
||||
void EditUpdateUrlIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool);
|
||||
void EditUpdateIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool bClearOnly);
|
||||
void EditSetAccelWordNav(HWND hwnd,bool);
|
||||
bool EditAutoCompleteWord(HWND hwnd,bool);
|
||||
void EditShowZeroLengthCallTip(HWND hwnd, DocPos iPosition);
|
||||
|
||||
296
src/Notepad3.c
296
src/Notepad3.c
@ -65,6 +65,8 @@ FILEWATCHING_T FileWatching;
|
||||
WININFO s_WinInfo = INIT_WININFO;
|
||||
WININFO s_DefWinInfo = INIT_WININFO;
|
||||
|
||||
COLORREF g_colorCustom[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
prefix_t s_mxSBPrefix[STATUS_SECTOR_COUNT];
|
||||
prefix_t s_mxSBPostfix[STATUS_SECTOR_COUNT];
|
||||
|
||||
@ -417,7 +419,7 @@ void ObserveNotifyChangeEvent()
|
||||
InterlockedDecrement(&iNotifyChangeStackCounter);
|
||||
}
|
||||
if (CheckNotifyChangeEvent()) {
|
||||
UpdateVisibleUrlIndics();
|
||||
UpdateVisibleHotspotIndicators();
|
||||
UpdateAllBars(false);
|
||||
}
|
||||
}
|
||||
@ -1488,7 +1490,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
// update Scintilla colors
|
||||
case WM_SYSCOLORCHANGE:
|
||||
EditUpdateUrlIndicators(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, false);
|
||||
MarkAllOccurrences(0, true);
|
||||
UpdateAllBars(false);
|
||||
return DefWindowProc(hwnd,umsg,wParam,lParam);
|
||||
@ -1675,7 +1677,6 @@ static void _SetWrapVisualFlags(HWND hwndEditCtrl)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// InitializeSciEditCtrl()
|
||||
@ -1781,6 +1782,20 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETHOVERSTYLE, INDIC_NP3_HYPERLINK_U, INDIC_COMPOSITIONTHICK);
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETHOVERFORE, INDIC_NP3_HYPERLINK_U, RGB(0x00, 0x00, 0xFF));
|
||||
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_COLOR_DEF, INDIC_HIDDEN); // MARKER only
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_COLOR_DEF, 0x00);
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETHOVERSTYLE, INDIC_NP3_COLOR_DEF, INDIC_BOX); // HOVER
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETHOVERFORE, INDIC_NP3_COLOR_DEF, RGB(0x80, 0x80, 0x80));
|
||||
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_COLOR_DWELL, INDIC_FULLBOX); // style on DWELLSTART
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_COLOR_DWELL, RGB(0xE0, 0xE0, 0xE0));
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETUNDER, INDIC_NP3_COLOR_DWELL, true);
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_COLOR_DWELL, 0xFF);
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_COLOR_DWELL, 0xFF);
|
||||
//SendMessage(hwndEditCtrl, SCI_INDICSETHOVERSTYLE, INDIC_NP3_COLOR_DWELL, INDIC_FULLBOX);
|
||||
//SendMessage(hwndEditCtrl, SCI_INDICSETHOVERFORE, INDIC_NP3_COLOR_DWELL, RGB(0xFF, 0xFF, 0xFF));
|
||||
|
||||
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_MULTI_EDIT, INDIC_ROUNDBOX);
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_MULTI_EDIT, RGB(0xFF, 0xA5, 0x00));
|
||||
SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_MULTI_EDIT, 60);
|
||||
@ -1796,10 +1811,10 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
|
||||
SendMessage(hwndEditCtrl, SCI_SETCARETSTICKY, (WPARAM)SC_CARETSTICKY_OFF, 0);
|
||||
//SendMessage(hwndEditCtrl,SCI_SETCARETSTICKY,SC_CARETSTICKY_WHITESPACE,0);
|
||||
|
||||
if (Settings.ShowHypLnkToolTip) {
|
||||
SendMessage(hwndEditCtrl, SCI_SETMOUSEDWELLTIME, (WPARAM)250, 0);
|
||||
if (Settings.ShowHypLnkToolTip || Settings.ColorDefHotspot) {
|
||||
SendMessage(hwndEditCtrl, SCI_SETMOUSEDWELLTIME, (WPARAM)100, 0);
|
||||
}
|
||||
else { // Hyperlink ToolTip is the only purpose for now, so globally disable it
|
||||
else {
|
||||
SendMessage(hwndEditCtrl, SCI_SETMOUSEDWELLTIME, (WPARAM)SC_TIME_FOREVER, 0); // default
|
||||
}
|
||||
|
||||
@ -2492,7 +2507,7 @@ LRESULT MsgDPIChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
SendWMSize(hwnd, rc);
|
||||
|
||||
UpdateUI();
|
||||
EditUpdateUrlIndicators(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, false);
|
||||
MarkAllOccurrences(0, true);
|
||||
UpdateAllBars(false);
|
||||
|
||||
@ -2554,7 +2569,7 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam ,LPARAM lParam)
|
||||
|
||||
SendWMSize(hwnd, NULL);
|
||||
|
||||
EditUpdateUrlIndicators(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, false);
|
||||
MarkAllOccurrences(0, true);
|
||||
if (FocusedView.HideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
|
||||
UpdateUI();
|
||||
@ -3270,6 +3285,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
CheckMenuRadioItem(hmenu, IDM_VIEW_HILITCURLN_NONE, IDM_VIEW_HILITCURLN_FRAME, i, MF_BYCOMMAND);
|
||||
|
||||
CheckCmd(hmenu, IDM_VIEW_HYPERLINKHOTSPOTS, Settings.HyperlinkHotspot);
|
||||
CheckCmd(hmenu, IDM_VIEW_COLORDEFHOTSPOTS, Settings.ColorDefHotspot);
|
||||
CheckCmd(hmenu, IDM_VIEW_SCROLLPASTEOF, Settings.ScrollPastEOF);
|
||||
CheckCmd(hmenu, IDM_VIEW_SHOW_HYPLNK_CALLTIP, Settings.ShowHypLnkToolTip);
|
||||
|
||||
@ -3427,7 +3443,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
switch(iLoWParam)
|
||||
{
|
||||
case SCEN_CHANGE:
|
||||
UpdateVisibleUrlIndics();
|
||||
UpdateVisibleHotspotIndicators();
|
||||
MarkAllOccurrences(Settings2.UpdateDelayMarkAllOccurrences, false);
|
||||
break;
|
||||
|
||||
@ -3853,7 +3869,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
s_bLastCopyFromMe = true;
|
||||
}
|
||||
if (!SciCall_IsSelectionEmpty() ||
|
||||
!HandleHotSpotURL(SciCall_GetCurrentPos(), COPY_HYPERLINK))
|
||||
!HandleHotSpotURLClicked(SciCall_GetCurrentPos(), COPY_HYPERLINK))
|
||||
{
|
||||
SciCall_CopyAllowLine();
|
||||
}
|
||||
@ -5274,7 +5290,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_VIEW_HYPERLINKHOTSPOTS:
|
||||
Settings.HyperlinkHotspot = !Settings.HyperlinkHotspot;
|
||||
EditUpdateUrlIndicators(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, true);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, false);
|
||||
break;
|
||||
|
||||
case IDM_VIEW_COLORDEFHOTSPOTS:
|
||||
Settings.ColorDefHotspot = !Settings.ColorDefHotspot;
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, true);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, false);
|
||||
break;
|
||||
|
||||
case IDM_VIEW_ZOOMIN:
|
||||
@ -5339,9 +5362,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_VIEW_SHOW_HYPLNK_CALLTIP:
|
||||
Settings.ShowHypLnkToolTip = !Settings.ShowHypLnkToolTip;
|
||||
// HyperlinkTooltip is the only purpose, so
|
||||
if (Settings.ShowHypLnkToolTip)
|
||||
SciCall_SetMouseDWellTime(250);
|
||||
if (Settings.ShowHypLnkToolTip || Settings.ColorDefHotspot)
|
||||
SciCall_SetMouseDWellTime(100);
|
||||
else
|
||||
Sci_DisableMouseDWellNotification();
|
||||
break;
|
||||
@ -6168,7 +6190,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case CMD_OPEN_HYPERLINK:
|
||||
HandleHotSpotURL(SciCall_GetCurrentPos(), (OPEN_WITH_BROWSER | OPEN_WITH_NOTEPAD3));
|
||||
HandleHotSpotURLClicked(SciCall_GetCurrentPos(), (OPEN_WITH_BROWSER | OPEN_WITH_NOTEPAD3));
|
||||
break;
|
||||
|
||||
case CMD_ALTDOWN:
|
||||
@ -6427,7 +6449,6 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
//
|
||||
// MsgSysCommand() - Handles WM_SYSCOMMAND
|
||||
//
|
||||
//
|
||||
LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (wParam) {
|
||||
@ -6455,55 +6476,156 @@ LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// HandlePosChange()
|
||||
//
|
||||
void HandlePosChange()
|
||||
{
|
||||
static DocPos prevPosition = -1;
|
||||
DocPos const curPos = SciCall_GetCurrentPos();
|
||||
if (curPos == prevPosition) { return; }
|
||||
|
||||
if (SciCall_IndicatorValueAt(INDIC_NP3_COLOR_DEF, curPos) > 0)
|
||||
{
|
||||
DocPos const firstPos = SciCall_IndicatorStart(INDIC_NP3_COLOR_DEF, curPos);
|
||||
DocPos const lastPos = SciCall_IndicatorEnd(INDIC_NP3_COLOR_DEF, curPos);
|
||||
DocPos const length = (lastPos - firstPos);
|
||||
|
||||
char chText[MIDSZ_BUFFER] = { '\0' };
|
||||
StringCchCopyNA(chText, COUNTOF(chText), SciCall_GetRangePointer(firstPos, length), length);
|
||||
unsigned int iValue = 0;
|
||||
if (sscanf_s(&chText[1], "%x", &iValue) == 1)
|
||||
{
|
||||
COLORREF const rgb = RGB((iValue & 0xFF0000) >> 16, (iValue & 0xFF00) >> 8, iValue & 0xFF);
|
||||
SciCall_IndicSetHoverFore(INDIC_NP3_COLOR_DEF, rgb);
|
||||
}
|
||||
}
|
||||
prevPosition = curPos;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// HandleDWellStartEnd()
|
||||
//
|
||||
//
|
||||
typedef enum _indic_id_t { _I_NONE = 0, _I_HYPERLINK = 1, _I_COLOR_PATTERN = 2 } _INDIC_ID_T;
|
||||
|
||||
void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
{
|
||||
static DocPos prevPosition = -1;
|
||||
static DocPos prevStartPosition = -1;
|
||||
static DocPos prevEndPosition = -1;
|
||||
|
||||
switch (uid)
|
||||
{
|
||||
case SCN_DWELLSTART:
|
||||
{
|
||||
//SciCall_SetCursor(SC_NP3_CURSORHAND);
|
||||
if (!Settings.ShowHypLnkToolTip || SciCall_CallTipActive() ||
|
||||
(SciCall_IndicatorValueAt(INDIC_NP3_HYPERLINK, position) <= 0)) { return; }
|
||||
_INDIC_ID_T indicator_type = _I_NONE;
|
||||
|
||||
char chURL[MIDSZ_BUFFER] = { '\0' };
|
||||
DocPos const firstPos = SciCall_IndicatorStart(INDIC_NP3_HYPERLINK, position);
|
||||
DocPos const lastPos = SciCall_IndicatorEnd(INDIC_NP3_HYPERLINK, position);
|
||||
if (Settings.HyperlinkHotspot) {
|
||||
if (SciCall_IndicatorValueAt(INDIC_NP3_HYPERLINK, position) > 0) {
|
||||
indicator_type = _I_HYPERLINK;
|
||||
if (position != prevPosition) {
|
||||
CancelCallTip();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.ColorDefHotspot) {
|
||||
if (SciCall_IndicatorValueAt(INDIC_NP3_COLOR_DEF, position) > 0) {
|
||||
indicator_type = _I_COLOR_PATTERN;
|
||||
}
|
||||
}
|
||||
|
||||
switch (indicator_type)
|
||||
{
|
||||
case _I_NONE:
|
||||
default:
|
||||
return; // nothing to do
|
||||
break;
|
||||
|
||||
case _I_HYPERLINK:
|
||||
if (!Settings.ShowHypLnkToolTip || SciCall_CallTipActive()) { return; }
|
||||
break;
|
||||
|
||||
case _I_COLOR_PATTERN:
|
||||
// ok
|
||||
break;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//SciCall_SetCursor(SC_NP3_CURSORHAND);
|
||||
|
||||
int const indicator_id = (_I_HYPERLINK == indicator_type) ? INDIC_NP3_HYPERLINK : INDIC_NP3_COLOR_DEF;
|
||||
|
||||
DocPos const firstPos = SciCall_IndicatorStart(indicator_id, position);
|
||||
DocPos const lastPos = SciCall_IndicatorEnd(indicator_id, position);
|
||||
DocPos const length = (lastPos - firstPos);
|
||||
|
||||
StringCchCopyNA(chURL, COUNTOF(chURL), SciCall_GetRangePointer(firstPos, length), length);
|
||||
StrTrimA(chURL, " \t\n\r");
|
||||
// WebLinks and Color Refs are ASCII only - No need for UTF-8 conversion here
|
||||
|
||||
if (StrIsEmptyA(chURL)) { return; }
|
||||
if (_I_HYPERLINK == indicator_type)
|
||||
{
|
||||
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)) { return; }
|
||||
|
||||
WCHAR wchCalltipAdd[SMALL_BUFFER] = { L'\0' };
|
||||
if (StrStrIA(chURL, "file:") == chURL) {
|
||||
GetLngString(IDS_MUI_URL_OPEN_FILE, wchCalltipAdd, COUNTOF(wchCalltipAdd));
|
||||
} else {
|
||||
GetLngString(IDS_MUI_URL_OPEN_BROWSER, wchCalltipAdd, COUNTOF(wchCalltipAdd));
|
||||
WCHAR wchCalltipAdd[SMALL_BUFFER] = { L'\0' };
|
||||
if (StrStrIA(chText, "file:") == chText) {
|
||||
GetLngString(IDS_MUI_URL_OPEN_FILE, wchCalltipAdd, COUNTOF(wchCalltipAdd));
|
||||
}
|
||||
else {
|
||||
GetLngString(IDS_MUI_URL_OPEN_BROWSER, wchCalltipAdd, COUNTOF(wchCalltipAdd));
|
||||
}
|
||||
CHAR chAdd[MIDSZ_BUFFER] = { L'\0' };
|
||||
WideCharToMultiByte(Encoding_SciCP, 0, wchCalltipAdd, -1, chAdd, COUNTOF(chAdd), NULL, NULL);
|
||||
|
||||
char chCallTip[LARGE_BUFFER] = { '\0' };
|
||||
//StringCchCatA(chCallTip, COUNTOF(chCallTip), "=> ");
|
||||
StringCchCatA(chCallTip, COUNTOF(chCallTip), chText);
|
||||
StringCchCatA(chCallTip, COUNTOF(chCallTip), chAdd);
|
||||
//SciCall_CallTipSetPosition(true);
|
||||
SciCall_CallTipShow(position, chCallTip);
|
||||
SciCall_CallTipSetHlt(0, (int)length);
|
||||
Globals.CallTipType = CT_DWELL;
|
||||
}
|
||||
CHAR chAdd[MIDSZ_BUFFER] = { L'\0' };
|
||||
WideCharToMultiByte(Encoding_SciCP, 0, wchCalltipAdd, -1, chAdd, COUNTOF(chAdd), NULL, NULL);
|
||||
else if (_I_COLOR_PATTERN == indicator_type)
|
||||
{
|
||||
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);
|
||||
unsigned int iValue = 0;
|
||||
if (sscanf_s(&chText[1], "%x", &iValue) == 1)
|
||||
{
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_COLOR_DWELL);
|
||||
SciCall_IndicatorClearRange(0, Sci_GetDocEndPosition());
|
||||
|
||||
char chCallTip[LARGE_BUFFER] = { '\0' };
|
||||
//StringCchCatA(chCallTip, COUNTOF(chCallTip), "=> ");
|
||||
StringCchCatA(chCallTip, COUNTOF(chCallTip), chURL);
|
||||
StringCchCatA(chCallTip, COUNTOF(chCallTip), chAdd);
|
||||
//SciCall_CallTipSetPosition(true);
|
||||
SciCall_CallTipShow(position, chCallTip);
|
||||
SciCall_CallTipSetHlt(0, (int)length);
|
||||
Globals.CallTipType = CT_DWELL;
|
||||
COLORREF const rgb = RGB((iValue & 0xFF0000) >> 16, (iValue & 0xFF00) >> 8, iValue & 0xFF);
|
||||
|
||||
SciCall_IndicSetHoverFore(INDIC_NP3_COLOR_DEF, rgb);
|
||||
SciCall_IndicSetFore(INDIC_NP3_COLOR_DWELL, rgb);
|
||||
SciCall_IndicatorFillRange(firstPos, length);
|
||||
}
|
||||
}
|
||||
prevPosition = position;
|
||||
prevStartPosition = firstPos;
|
||||
prevEndPosition = lastPos;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCN_DWELLEND:
|
||||
{
|
||||
//SciCall_SetCursor(SC_CURSORNORMAL);
|
||||
if ((position >= prevStartPosition) && ((position <= prevEndPosition))) { return; } // avoid flickering
|
||||
CancelCallTip();
|
||||
|
||||
DocPos const curPos = SciCall_GetCurrentPos();
|
||||
if ((curPos >= prevStartPosition) && ((curPos <= prevEndPosition))) { return; } // no change for if caret in range
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_COLOR_DWELL);
|
||||
SciCall_IndicatorClearRange(0, Sci_GetDocEndPosition());
|
||||
HandlePosChange();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6514,10 +6636,10 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// HandleHotSpotURL()
|
||||
// HandleHotSpotURLClicked()
|
||||
//
|
||||
//
|
||||
bool HandleHotSpotURL(const DocPos position, const HYPERLINK_OPS operation)
|
||||
bool HandleHotSpotURLClicked(const DocPos position, const HYPERLINK_OPS operation)
|
||||
{
|
||||
CancelCallTip();
|
||||
//PostMessage(Globals.hwndEdit, WM_LBUTTONUP, MK_LBUTTON, 0);
|
||||
@ -6596,6 +6718,52 @@ bool HandleHotSpotURL(const DocPos position, const HYPERLINK_OPS operation)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// HandleColorDefClicked()
|
||||
//
|
||||
void HandleColorDefClicked(HWND hwnd, const DocPos position)
|
||||
{
|
||||
if (SciCall_IndicatorValueAt(INDIC_NP3_COLOR_DEF, position) == 0) { return; }
|
||||
|
||||
DocPos const firstPos = SciCall_IndicatorStart(INDIC_NP3_COLOR_DEF, position);
|
||||
DocPos const lastPos = SciCall_IndicatorEnd(INDIC_NP3_COLOR_DEF, position);
|
||||
DocPos const length = (lastPos - firstPos);
|
||||
|
||||
char chText[32] = { '\0' };
|
||||
// Color Refs are ASCII only - No need for UTF-8 conversion here
|
||||
StringCchCopyNA(chText, COUNTOF(chText), SciCall_GetRangePointer(firstPos, length), length);
|
||||
unsigned int iValue = 0;
|
||||
if (sscanf_s(&chText[1], "%x", &iValue) == 1)
|
||||
{
|
||||
COLORREF const rgbCur = RGB((iValue & 0xFF0000) >> 16, (iValue & 0xFF00) >> 8, iValue & 0xFF);
|
||||
|
||||
CHOOSECOLOR cc;
|
||||
ZeroMemory(&cc, sizeof(CHOOSECOLOR));
|
||||
cc.lStructSize = sizeof(CHOOSECOLOR);
|
||||
cc.hwndOwner = hwnd;
|
||||
cc.rgbResult = rgbCur;
|
||||
cc.lpCustColors = g_colorCustom;
|
||||
cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_SOLIDCOLOR;
|
||||
|
||||
if (!ChooseColor(&cc)) { return; }
|
||||
|
||||
COLORREF const rgbNew = cc.rgbResult;
|
||||
|
||||
CHAR wchColor[32] = { L'\0' };
|
||||
StringCchPrintfA(wchColor, COUNTOF(wchColor), "#%02X%02X%02X",
|
||||
(int)GetRValue(rgbNew), (int)GetGValue(rgbNew), (int)GetBValue(rgbNew));
|
||||
|
||||
DocPos const saveTargetBeg = SciCall_GetTargetStart();
|
||||
DocPos const saveTargetEnd = SciCall_GetTargetEnd();
|
||||
|
||||
SciCall_SetTargetRange(firstPos, lastPos);
|
||||
SciCall_ReplaceTarget(length, wchColor);
|
||||
|
||||
SciCall_SetTargetRange(saveTargetBeg, saveTargetEnd); //restore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
@ -6858,9 +7026,8 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
if (IsMarkOccurrencesEnabled()) {
|
||||
MarkAllOccurrences(Settings2.UpdateDelayMarkAllOccurrences, true);
|
||||
}
|
||||
if (Settings.HyperlinkHotspot) {
|
||||
UpdateVisibleUrlIndics();
|
||||
}
|
||||
UpdateVisibleHotspotIndicators();
|
||||
|
||||
if (scn->linesAdded != 0) {
|
||||
UpdateMarginWidth();
|
||||
}
|
||||
@ -6917,8 +7084,9 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
// ignoring SC_UPDATE_CONTENT cause Style and Marker are out of scope here
|
||||
// using WM_COMMAND -> SCEN_CHANGE instead!
|
||||
//~~~MarkAllOccurrences(Settings2.UpdateDelayMarkAllCoccurrences, false);
|
||||
//~~~UpdateVisibleUrlIndics();
|
||||
//~~~UpdateVisibleHotspotIndicators();
|
||||
//}
|
||||
HandlePosChange();
|
||||
UpdateToolbar();
|
||||
UpdateStatusbar(false);
|
||||
}
|
||||
@ -6928,10 +7096,7 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
MarkAllOccurrences(Settings2.UpdateDelayMarkAllOccurrences, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.HyperlinkHotspot) {
|
||||
UpdateVisibleUrlIndics();
|
||||
}
|
||||
UpdateVisibleHotspotIndicators();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6953,13 +7118,20 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
|
||||
case SCN_INDICATORRELEASE:
|
||||
{
|
||||
if (_s_indic_click_modifiers & SCMOD_CTRL) {
|
||||
// open in browser
|
||||
HandleHotSpotURL(scn->position, OPEN_WITH_BROWSER);
|
||||
if (SciCall_IndicatorValueAt(INDIC_NP3_HYPERLINK, scn->position) > 0)
|
||||
{
|
||||
if (_s_indic_click_modifiers & SCMOD_CTRL) {
|
||||
HandleHotSpotURLClicked(scn->position, OPEN_WITH_BROWSER);
|
||||
}
|
||||
else if (_s_indic_click_modifiers & SCMOD_ALT) {
|
||||
HandleHotSpotURLClicked(scn->position, OPEN_WITH_NOTEPAD3); // if applicable (file://)
|
||||
}
|
||||
}
|
||||
else if (_s_indic_click_modifiers & SCMOD_ALT) {
|
||||
// open in application, if applicable (file://)
|
||||
HandleHotSpotURL(scn->position, OPEN_WITH_NOTEPAD3);
|
||||
else if (SciCall_IndicatorValueAt(INDIC_NP3_COLOR_DEF, scn->position) > 0)
|
||||
{
|
||||
if (_s_indic_click_modifiers & SCMOD_ALT) {
|
||||
HandleColorDefClicked(Globals.hwndEdit, scn->position);
|
||||
}
|
||||
}
|
||||
_s_indic_click_modifiers = 0;
|
||||
}
|
||||
@ -7019,7 +7191,7 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
|
||||
DocLn const iFirstLine = SciCall_LineFromPosition(scn->position);
|
||||
DocLn const iLastLine = SciCall_LineFromPosition(scn->position + scn->length - 1);
|
||||
for (DocLn i = iFirstLine; i <= iLastLine; ++i) { SciCall_EnsureVisible(i); }
|
||||
UpdateVisibleUrlIndics();
|
||||
UpdateVisibleHotspotIndicators();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -7808,13 +7980,13 @@ void MarkAllOccurrences(int delay, bool bForceClear)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UpdateVisibleUrlIndics()
|
||||
// UpdateVisibleHotspotIndicators()
|
||||
//
|
||||
void UpdateVisibleUrlIndics()
|
||||
void UpdateVisibleHotspotIndicators()
|
||||
{
|
||||
DocLn const iStartLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine());
|
||||
DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1));
|
||||
EditUpdateUrlIndicators(Globals.hwndEdit, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), Settings.HyperlinkHotspot);
|
||||
EditUpdateIndicators(Globals.hwndEdit, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ void UpdateToolbar();
|
||||
void UpdateStatusbar(bool);
|
||||
void UpdateMarginWidth();
|
||||
void UpdateSettingsCmds();
|
||||
void UpdateVisibleUrlIndics();
|
||||
void UpdateVisibleHotspotIndicators();
|
||||
inline void UpdateAllBars(bool force) { UpdateToolbar(); UpdateStatusbar(force); UpdateMarginWidth(); }
|
||||
|
||||
void UndoRedoRecordingStart();
|
||||
@ -155,8 +155,10 @@ bool RestoreAction(int token, DoAction doAct);
|
||||
#define _BEGIN_UNDO_ACTION_ { int const _token_ = BeginUndoAction(); __try {
|
||||
#define _END_UNDO_ACTION_ } __finally { EndUndoAction(_token_); } }
|
||||
|
||||
void HandlePosChange();
|
||||
void HandleDWellStartEnd(const DocPos position, const UINT uid);
|
||||
bool HandleHotSpotURL(const DocPos position, const HYPERLINK_OPS operation);
|
||||
bool HandleHotSpotURLClicked(const DocPos position, const HYPERLINK_OPS operation);
|
||||
void HandleColorDefClicked(HWND hwnd, const DocPos position);
|
||||
|
||||
bool IsFindPatternEmpty();
|
||||
void SetFindPattern(LPCWSTR wchFindPattern);
|
||||
|
||||
@ -98,34 +98,37 @@ BEGIN
|
||||
"9", CMD_TOGGLETITLE, VIRTKEY, CONTROL, NOINVERT
|
||||
"9", IDM_VIEW_SHOWEOLS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"A", IDM_EDIT_SELECTALL, VIRTKEY, CONTROL, NOINVERT
|
||||
"A", IDM_VIEW_MARKOCCUR_ONOFF, VIRTKEY, ALT, NOINVERT
|
||||
"A", IDM_VIEW_MARKOCCUR_ONOFF, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"A", CMD_RECODEANSI, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"A", IDM_VIEW_ACCELWORDNAV, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"B", IDM_EDIT_FINDMATCHINGBRACE, VIRTKEY, CONTROL, NOINVERT
|
||||
"B", IDM_EDIT_PADWITHSPACES, VIRTKEY, ALT, NOINVERT
|
||||
"B", IDM_EDIT_PADWITHSPACES, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"B", IDM_EDIT_SELTOMATCHINGBRACE, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"B", IDM_EDIT_REMOVEBLANKLINES, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||
"C", IDM_EDIT_COPYALL, VIRTKEY, ALT, NOINVERT
|
||||
"C", IDM_EDIT_COPYALL, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"C", IDM_EDIT_HEX2CHAR, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"C", IDM_EDIT_COPY, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"D", IDM_EDIT_DUPLINEORSELECTION, VIRTKEY, CONTROL, NOINVERT
|
||||
"D", IDM_EDIT_LINETRANSPOSE, VIRTKEY, ALT, NOINVERT
|
||||
"D", IDM_EDIT_LINETRANSPOSE, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"D", IDM_EDIT_DELETELINE, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"D", IDM_EDIT_REMOVEDUPLICATELINES, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"E", IDM_EDIT_COPYADD, VIRTKEY, CONTROL, NOINVERT
|
||||
"E", IDM_EDIT_ESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"E", IDM_EDIT_URLENCODE, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//~"E", MMMMMMMMMMMMMMMMMM, VIRTKEY, ALT, NOINVERT /// Menu(Edit)
|
||||
"F", IDM_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
|
||||
"F", CMD_RECODEDEFAULT, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"F", IDM_VIEW_FOLDING, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT
|
||||
"F", IDM_VIEW_TOGGLEFOLDS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//~"F", MMMMMMMMMMMMMMMMMM, VIRTKEY, ALT, NOINVERT /// Menu(File)
|
||||
"G", IDM_EDIT_GOTOLINE, VIRTKEY, CONTROL, NOINVERT
|
||||
"G", IDM_VIEW_SHOWINDENTGUIDES, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"G", IDM_VIEW_TRANSPARENT, VIRTKEY, ALT, NOINVERT
|
||||
"G", IDM_VIEW_TRANSPARENT, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"H", IDM_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT
|
||||
"H", IDM_FILE_RECENT, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"H", IDM_VIEW_AUTOCLOSETAGS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//~"H", MMMMMMMMMMMMMMMMMM, VIRTKEY, ALT, NOINVERT /// Menu(Help)
|
||||
"I", IDM_EDIT_SPLITLINES, VIRTKEY, CONTROL, NOINVERT
|
||||
"I", IDM_FILE_OPENFAV, VIRTKEY, ALT, NOINVERT
|
||||
"I", IDM_EDIT_TITLECASE, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
@ -133,62 +136,66 @@ BEGIN
|
||||
"J", IDM_EDIT_JOINLINES, VIRTKEY, CONTROL, NOINVERT
|
||||
"J", IDM_EDIT_JOINLN_NOSP, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"J", IDM_EDIT_JOINLINES_PARA, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"J", IDM_EDIT_ALIGN, VIRTKEY, ALT, NOINVERT
|
||||
"J", IDM_EDIT_ALIGN, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"K", IDM_EDIT_SWAP, VIRTKEY, CONTROL, NOINVERT
|
||||
"K", IDM_FILE_ADDTOFAV, VIRTKEY, ALT, NOINVERT
|
||||
"K", CMD_COPYWINPOS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//"K", IDM_VIEW_COLORDEFHOTSPOTS, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"L", IDM_FILE_LAUNCH, VIRTKEY, CONTROL, NOINVERT
|
||||
"L", IDM_FILE_OPENWITH, VIRTKEY, ALT, NOINVERT
|
||||
"L", IDM_VIEW_LONGLINEMARKER, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"M", IDM_FILE_BROWSE, VIRTKEY, CONTROL, NOINVERT
|
||||
"M", IDM_EDIT_MODIFYLINES, VIRTKEY, ALT, NOINVERT
|
||||
"M", IDM_EDIT_MODIFYLINES, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"M", IDM_VIEW_MARGIN, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||
"N", IDM_FILE_NEWWINDOW, VIRTKEY, ALT, NOINVERT
|
||||
"N", IDM_FILE_NEWWINDOW, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"N", IDM_FILE_NEWWINDOW2, VIRTKEY, SHIFT, ALT, NOINVERT
|
||||
"N", IDM_VIEW_LINENUMBERS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||
"O", IDM_EDIT_SORTLINES, VIRTKEY, ALT, NOINVERT
|
||||
"O", IDM_EDIT_SORTLINES, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"O", IDM_EDIT_SENTENCECASE, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"O", CMD_RECODEOEM, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
|
||||
"P", IDM_EDIT_COMPRESS_BLANKS, VIRTKEY, ALT, NOINVERT
|
||||
"P", CMD_DEFAULTWINPOS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//~"P", MMMMMMMMMMMMMMMMMM, VIRTKEY, ALT, NOINVERT /// Menu(Appearance)
|
||||
"Q", IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT
|
||||
"Q", IDM_EDIT_ENCLOSESELECTION, VIRTKEY, ALT, NOINVERT
|
||||
"Q", IDM_EDIT_ENCLOSESELECTION, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"Q", IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"R", IDM_FILE_RUN, VIRTKEY, CONTROL, NOINVERT
|
||||
"R", IDM_EDIT_REMOVEEMPTYLINES, VIRTKEY, ALT, NOINVERT
|
||||
"R", IDM_EDIT_REMOVEEMPTYLINES, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"R", IDM_EDIT_UNESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"R", IDM_EDIT_URLDECODE, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
|
||||
"S", IDM_EDIT_CONVERTTABS2, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"S", IDM_EDIT_CONVERTTABS, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//~"S", MMMMMMMMMMMMMMMMMM, VIRTKEY, ALT, NOINVERT /// Menu(Settings)
|
||||
"T", IDM_VIEW_TABSETTINGS, VIRTKEY, CONTROL, NOINVERT
|
||||
"T", IDM_VIEW_ALWAYSONTOP, VIRTKEY, ALT, NOINVERT
|
||||
"T", IDM_VIEW_ALWAYSONTOP, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"T", IDM_EDIT_CONVERTSPACES2, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"T", IDM_EDIT_CONVERTSPACES, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"U", IDM_EDIT_CONVERTLOWERCASE, VIRTKEY, CONTROL, NOINVERT
|
||||
"U", IDM_EDIT_STRIPLASTCHAR, VIRTKEY, ALT, NOINVERT
|
||||
"U", IDM_EDIT_STRIPLASTCHAR, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"U", IDM_EDIT_INVERTCASE, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"U", IDM_EDIT_CONVERTUPPERCASE, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
|
||||
"V", IDM_VIEW_MATCHBRACES, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"V", IDM_VIEW_TOGGLE_VIEW, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
//~"V", MMMMMMMMMMMMMMMMMM, VIRTKEY, ALT, NOINVERT /// Menu(View)
|
||||
"W", IDM_VIEW_WORDWRAP, VIRTKEY, CONTROL, NOINVERT
|
||||
"W", IDM_EDIT_TRIMLINES, VIRTKEY, ALT, NOINVERT
|
||||
"W", IDM_EDIT_TRIMLINES, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"W", IDM_EDIT_COLUMNWRAP, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"W", IDM_VIEW_HYPERLINKHOTSPOTS, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
|
||||
"X", IDM_EDIT_INSERT_TAG, VIRTKEY, ALT, NOINVERT
|
||||
"X", IDM_EDIT_INSERT_TAG, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"X", IDM_EDIT_CHAR2HEX, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"X", IDM_EDIT_CUTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT
|
||||
"Y", IDM_EDIT_MERGEEMPTYLINES, VIRTKEY, ALT, NOINVERT
|
||||
"Y", IDM_EDIT_MERGEEMPTYLINES, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"Y", IDM_EDIT_UNDO, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"Y", IDM_EDIT_MERGEBLANKLINES, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
"Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
|
||||
"Z", IDM_EDIT_STRIP1STCHAR, VIRTKEY, ALT, NOINVERT
|
||||
"Z", IDM_EDIT_STRIP1STCHAR, VIRTKEY, ALT, NOINVERT /// NO Menu
|
||||
"Z", IDM_EDIT_REDO, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
//VK_LEFT, CMD_LEFT, VIRTKEY, NOINVERT
|
||||
VK_LEFT, CMD_CTRLLEFT, VIRTKEY, CONTROL, NOINVERT
|
||||
|
||||
@ -441,6 +441,7 @@ DeclareSciCallR0(GetMaxLineState, GETMAXLINESTATE, DocLn)
|
||||
//
|
||||
DeclareSciCallV2(IndicSetStyle, INDICSETSTYLE, int, indicatorID, int, style)
|
||||
DeclareSciCallV2(IndicSetFore, INDICSETFORE, int, indicatorID, COLORREF, colour)
|
||||
DeclareSciCallV2(IndicSetUnder, INDICSETUNDER, int, indicatorID, bool, under)
|
||||
DeclareSciCallV2(IndicSetHoverStyle, INDICSETHOVERSTYLE, int, indicatorID, int, style)
|
||||
DeclareSciCallV2(IndicSetHoverFore, INDICSETHOVERFORE, int, indicatorID, COLORREF, colour)
|
||||
DeclareSciCallV2(IndicSetAlpha, INDICSETALPHA, int, indicatorID, int, alpha)
|
||||
|
||||
30
src/Styles.c
30
src/Styles.c
@ -39,6 +39,7 @@
|
||||
#include "Styles.h"
|
||||
|
||||
extern const int g_FontQuality[4];
|
||||
extern COLORREF g_colorCustom[16];
|
||||
|
||||
bool ChooseFontDirectWrite(HWND hwnd, const WCHAR* localeName, DPI_T dpi, LPCHOOSEFONT lpCF);
|
||||
|
||||
@ -126,8 +127,6 @@ const COLORREF s_colorDefault[16] =
|
||||
RGB(0xB2, 0x8B, 0x40)
|
||||
};
|
||||
|
||||
static COLORREF s_colorCustom[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
static bool s_bAutoSelect = true;
|
||||
|
||||
#define STYLESELECTDLG_X 304
|
||||
@ -483,7 +482,7 @@ void Style_Load()
|
||||
_SetCurrentFontSize(fBFS);
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
s_colorCustom[i] = s_colorDefault[i];
|
||||
g_colorCustom[i] = s_colorDefault[i];
|
||||
}
|
||||
|
||||
// 2nd Default Style has same filename extension list as (1st) Default Style
|
||||
@ -559,7 +558,7 @@ bool Style_ImportFromFile(const WCHAR* szFile)
|
||||
if (bResetToDefault)
|
||||
{
|
||||
for (int i = 0; i < 16; i++) {
|
||||
s_colorCustom[i] = s_colorDefault[i];
|
||||
g_colorCustom[i] = s_colorDefault[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -575,12 +574,12 @@ bool Style_ImportFromFile(const WCHAR* szFile)
|
||||
unsigned int irgb;
|
||||
itok = swscanf_s(CharNext(wch), L"%x", &irgb);
|
||||
if (itok == 1) {
|
||||
s_colorCustom[i] = RGB((irgb & 0xFF0000) >> 16, (irgb & 0xFF00) >> 8, irgb & 0xFF);
|
||||
g_colorCustom[i] = RGB((irgb & 0xFF0000) >> 16, (irgb & 0xFF00) >> 8, irgb & 0xFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itok != 1) {
|
||||
s_colorCustom[i] = s_colorDefault[i];
|
||||
g_colorCustom[i] = s_colorDefault[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -703,12 +702,12 @@ bool Style_ExportToFile(const WCHAR* szFile, bool bForceAll)
|
||||
const WCHAR* const CustomColors_Section = L"Custom Colors";
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (bForceAll || (s_colorCustom[i] != s_colorDefault[i])) {
|
||||
if (bForceAll || (g_colorCustom[i] != s_colorDefault[i])) {
|
||||
WCHAR tch[32] = { L'\0' };
|
||||
WCHAR wch[32] = { L'\0' };
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"%02i", i + 1);
|
||||
StringCchPrintf(wch, COUNTOF(wch), L"#%02X%02X%02X",
|
||||
(int)GetRValue(s_colorCustom[i]), (int)GetGValue(s_colorCustom[i]), (int)GetBValue(s_colorCustom[i]));
|
||||
(int)GetRValue(g_colorCustom[i]), (int)GetGValue(g_colorCustom[i]), (int)GetBValue(g_colorCustom[i]));
|
||||
IniSectionSetString(CustomColors_Section, tch, wch);
|
||||
}
|
||||
}
|
||||
@ -1442,7 +1441,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
|
||||
// apply lexer styles
|
||||
Sci_ApplyLexerStyle(0, -1);
|
||||
EditUpdateUrlIndicators(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
|
||||
EditUpdateIndicators(Globals.hwndEdit, 0, -1, false);
|
||||
|
||||
if (bFocusedView) { EditToggleView(Globals.hwndEdit); }
|
||||
|
||||
@ -3230,29 +3229,24 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
|
||||
//
|
||||
bool Style_SelectColor(HWND hwnd,bool bForeGround,LPWSTR lpszStyle,int cchStyle, bool bPreserveStyles)
|
||||
{
|
||||
CHOOSECOLOR cc;
|
||||
WCHAR szNewStyle[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
COLORREF dRGBResult;
|
||||
COLORREF dColor;
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
|
||||
ZeroMemory(&cc,sizeof(CHOOSECOLOR));
|
||||
|
||||
dRGBResult = (bForeGround) ? GetSysColor(COLOR_WINDOWTEXT) : GetSysColor(COLOR_WINDOW);
|
||||
Style_StrGetColor(lpszStyle, (bForeGround ? FOREGROUND_LAYER : BACKGROUND_LAYER), &dRGBResult);
|
||||
|
||||
CHOOSECOLOR cc;
|
||||
ZeroMemory(&cc, sizeof(CHOOSECOLOR));
|
||||
cc.lStructSize = sizeof(CHOOSECOLOR);
|
||||
cc.hwndOwner = hwnd;
|
||||
cc.rgbResult = dRGBResult;
|
||||
cc.lpCustColors = s_colorCustom;
|
||||
cc.lpCustColors = g_colorCustom;
|
||||
cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_SOLIDCOLOR;
|
||||
|
||||
if (!ChooseColor(&cc))
|
||||
return false;
|
||||
|
||||
if (!ChooseColor(&cc)) { return false; }
|
||||
dRGBResult = cc.rgbResult;
|
||||
|
||||
|
||||
// Rebuild style string
|
||||
StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L""); // clear
|
||||
|
||||
|
||||
@ -251,14 +251,15 @@ typedef struct _cmq
|
||||
|
||||
#define MARKER_NP3_BOOKMARK 1
|
||||
|
||||
#define INDIC_NP3_MARK_OCCURANCE (INDIC_CONTAINER + 1)
|
||||
#define INDIC_NP3_MATCH_BRACE (INDIC_CONTAINER + 2)
|
||||
#define INDIC_NP3_BAD_BRACE (INDIC_CONTAINER + 3)
|
||||
#define INDIC_NP3_FOCUS_VIEW (INDIC_CONTAINER + 4)
|
||||
#define INDIC_NP3_HYPERLINK (INDIC_CONTAINER + 5)
|
||||
#define INDIC_NP3_HYPERLINK_U (INDIC_CONTAINER + 6)
|
||||
#define INDIC_NP3_MULTI_EDIT (INDIC_CONTAINER + 7)
|
||||
|
||||
#define INDIC_NP3_MARK_OCCURANCE (INDIC_CONTAINER + 1)
|
||||
#define INDIC_NP3_MATCH_BRACE (INDIC_CONTAINER + 2)
|
||||
#define INDIC_NP3_BAD_BRACE (INDIC_CONTAINER + 3)
|
||||
#define INDIC_NP3_FOCUS_VIEW (INDIC_CONTAINER + 4)
|
||||
#define INDIC_NP3_HYPERLINK (INDIC_CONTAINER + 5)
|
||||
#define INDIC_NP3_HYPERLINK_U (INDIC_CONTAINER + 6)
|
||||
#define INDIC_NP3_COLOR_DEF (INDIC_CONTAINER + 7) // (HIDDEN)
|
||||
#define INDIC_NP3_COLOR_DWELL (INDIC_CONTAINER + 8)
|
||||
#define INDIC_NP3_MULTI_EDIT (INDIC_CONTAINER + 9)
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@ -350,6 +351,7 @@ typedef struct _settings_t
|
||||
bool AutoCloseTags;
|
||||
int HighlightCurrentLine;
|
||||
bool HyperlinkHotspot;
|
||||
bool ColorDefHotspot;
|
||||
bool ScrollPastEOF;
|
||||
bool ShowHypLnkToolTip;
|
||||
bool AutoIndent;
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 614
|
||||
#define VERSION_BUILD 2255
|
||||
#define VERSION_REV 615
|
||||
#define VERSION_BUILD 2256
|
||||
#define SCINTILLA_VER 416
|
||||
#define ONIGURUMA_REGEX_VER 6.9.2
|
||||
#define VERSION_PATCH Oniguruma
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
# This is a TOML document. - encoding:UTF-8
|
||||
# https://github.com/toml-lang/toml
|
||||
#
|
||||
|
||||
title = "TOML Example"
|
||||
|
||||
@ -12,6 +14,15 @@ ports = [ 8001, 8001, 8002 ]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
|
||||
[colors]
|
||||
color1 = "#D=8020"
|
||||
color2 = "#FFC000"
|
||||
color3 = "#00XX00"
|
||||
color4 = "#608020"
|
||||
color4 = "#608020"
|
||||
color4 = "#608020"
|
||||
color4 = "#608020"
|
||||
|
||||
[servers]
|
||||
|
||||
# Indentation (tabs and/or spaces) is allowed but not required
|
||||
|
||||
Loading…
Reference in New Issue
Block a user