+add: Change History Marker

This commit is contained in:
METANEOCORTEX\Kotti 2022-08-30 02:56:09 +02:00
parent ed62b129b4
commit bdf3794a4f
13 changed files with 93 additions and 28 deletions

View File

@ -1 +1 @@
1
2

View File

@ -763,6 +763,7 @@
#define IDM_VIEW_UNICODE_POINTS 41055
#define IDM_VIEW_WIN_DARK_MODE 41056
#define IDM_VIEW_READONLY 41057
#define IDM_VIEW_CHGHISTORY_MARGIN 41058
// keep Scintilla(SC) order
#define IDM_SET_RENDER_TECH_GDI 42000 // SC_TECHNOLOGY_DEFAULT(0)

View File

@ -384,6 +384,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Zeilen &Nummern\tCtrl+Shift+N", IDM_VIEW_LINENUMBERS
MENUITEM "&Lesezeichen Rand\tCtrl+Shift+M", IDM_VIEW_BOOKMARK_MARGIN
MENUITEM "Änderung &Historie Rand", IDM_VIEW_CHGHISTORY_MARGIN
MENUITEM SEPARATOR
POPUP "Code &Faltung"
BEGIN
@ -582,6 +583,7 @@ BEGIN
MENUITEM "Code Faltung", IDM_VIEW_FOLDING
MENUITEM "Zeilen Nummern", IDM_VIEW_LINENUMBERS
MENUITEM "Lesezeichen Rand", IDM_VIEW_BOOKMARK_MARGIN
MENUITEM "Änderung Historie Rand", IDM_VIEW_CHGHISTORY_MARGIN
END
POPUP "+"
BEGIN

View File

@ -384,6 +384,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Line &Numbers\tCtrl+Shift+N", IDM_VIEW_LINENUMBERS
MENUITEM "Bookmark &Margin\tCtrl+Shift+M", IDM_VIEW_BOOKMARK_MARGIN
MENUITEM "Change &History Margin", IDM_VIEW_CHGHISTORY_MARGIN
MENUITEM SEPARATOR
POPUP "&Folding"
BEGIN
@ -582,6 +583,7 @@ BEGIN
MENUITEM "Folding", IDM_VIEW_FOLDING
MENUITEM "Line Numbers", IDM_VIEW_LINENUMBERS
MENUITEM "Bookmark Margin", IDM_VIEW_BOOKMARK_MARGIN
MENUITEM "Change History Margin", IDM_VIEW_CHGHISTORY_MARGIN
END
POPUP "+"
BEGIN

View File

@ -3,8 +3,8 @@
<assemblyIdentity
name="Rizonesoft.Notepad3"
processorArchitecture="*"
version="5.22.829.1"
version="5.22.829.2"
type="win32"
/>
<description>Notepad3 beta</description>
<description>Notepad3 LongPath</description>
</assembly>

View File

@ -1523,6 +1523,7 @@ void LoadSettings()
GET_BOOL_VALUE_FROM_INISECTION(AutoDetectIndentSettings, false);
GET_BOOL_VALUE_FROM_INISECTION(ShowBookmarkMargin, IniSectionGetBool(IniSecSettings, L"ShowSelectionMargin", true));
GET_BOOL_VALUE_FROM_INISECTION(ShowChangeHistoryMargin, IniSectionGetBool(IniSecSettings, L"ShowChangeHistoryMargin", true));
GET_BOOL_VALUE_FROM_INISECTION(ShowLineNumbers, true);
GET_BOOL_VALUE_FROM_INISECTION(ShowCodeFolding, true);
FocusedView.ShowCodeFolding = Settings.ShowCodeFolding;
@ -1986,6 +1987,7 @@ static bool _SaveSettings(bool bForceSaveSettings)
IniSectionDelete(IniSecSettings, L"MultiEdgeLines", false);
}
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ShowBookmarkMargin);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ShowChangeHistoryMargin);
IniSectionDelete(IniSecSettings, L"ShowSelectionMargin", false); // old
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ShowLineNumbers);

View File

@ -2213,7 +2213,13 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
SciCall_SetMargins(NUMBER_OF_MARGINS);
SciCall_SetMarginTypeN(MARGIN_SCI_LINENUM, SC_MARGIN_NUMBER);
SciCall_SetMarginTypeN(MARGIN_SCI_BOOKMRK, SC_MARGIN_SYMBOL);
SciCall_SetMarginMaskN(MARGIN_SCI_BOOKMRK, ~SC_MASK_FOLDERS & ~MARGIN_MARK_HISTORY_MASK);
SciCall_SetMarginTypeN(MARGIN_SCI_CHGHIST, SC_MARGIN_SYMBOL);
SciCall_SetMarginMaskN(MARGIN_SCI_CHGHIST, MARGIN_MARK_HISTORY_MASK);
SciCall_SetMarginTypeN(MARGIN_SCI_FOLDING, SC_MARGIN_COLOUR);
SciCall_SetMarginMaskN(MARGIN_SCI_FOLDING, SC_MASK_FOLDERS);
@ -3702,6 +3708,7 @@ LRESULT MsgContextMenu(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
const SCNotification* const scn = (SCNotification*)lParam;
switch (scn->margin) {
case MARGIN_SCI_FOLDING:
case MARGIN_SCI_CHGHIST:
case MARGIN_SCI_BOOKMRK:
case MARGIN_SCI_LINENUM:
imenu = MNU_MARGIN;
@ -4137,6 +4144,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
CheckCmd(hmenu, IDM_VIEW_SHOWINDENTGUIDES, Settings.ShowIndentGuides);
CheckCmd(hmenu, IDM_VIEW_LINENUMBERS, Settings.ShowLineNumbers);
CheckCmd(hmenu, IDM_VIEW_BOOKMARK_MARGIN, Settings.ShowBookmarkMargin);
CheckCmd(hmenu, IDM_VIEW_CHGHISTORY_MARGIN, Settings.ShowChangeHistoryMargin);
CheckCmd(hmenu, IDM_VIEW_CHASING_DOCTAIL, FileWatching.MonitoringLog);
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_ONOFF, IsMarkOccurrencesEnabled());
@ -5785,6 +5793,11 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
UpdateMarginWidth(true);
break;
case IDM_VIEW_CHGHISTORY_MARGIN:
Settings.ShowChangeHistoryMargin = !Settings.ShowChangeHistoryMargin;
UpdateMarginWidth(true);
break;
case IDM_SET_AUTOCOMPLETEWORDS:
Settings.AutoCompleteWords = !Settings.AutoCompleteWords;
SciCall_AutoCCancel();
@ -8402,6 +8415,7 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
case MARGIN_SCI_BOOKMRK:
EditBookmarkToggle(Globals.hwndEdit, SciCall_LineFromPosition(scn->position), scn->modifiers);
break;
case MARGIN_SCI_CHGHIST:
case MARGIN_SCI_LINENUM:
//~SciCall_GotoLine(SciCall_LineFromPosition(scn->position));
// fallthrough
@ -9970,6 +9984,7 @@ void UpdateMarginWidth(const bool bForce)
SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, 0);
}
Style_SetBookmark(Globals.hwndEdit, Settings.ShowBookmarkMargin);
Style_SetChangeHistory(Globals.hwndEdit, Settings.ShowChangeHistoryMargin);
Style_SetFolding(Globals.hwndEdit, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
bShowLnNums = Settings.ShowLineNumbers;
prevLineCount = currLineCount;
@ -10067,6 +10082,7 @@ void UndoRedoRecordingStart()
InterlockedExchange(&UndoActionToken, UNDOREDO_FREE); // clear
_UndoRedoActionMap(-1, NULL);
SciCall_SetUndoCollection(true);
SciCall_SetChangeHistory(SC_CHANGE_HISTORY_ENABLED | SC_CHANGE_HISTORY_MARKERS | SC_CHANGE_HISTORY_INDICATORS);
}
@ -10083,6 +10099,7 @@ void UndoRedoRecordingStop()
_UndoRedoActionMap(-1, NULL);
SciCall_SetChangeHistory(SC_CHANGE_HISTORY_DISABLED);
SciCall_SetUndoCollection(false);
SciCall_EmptyUndoBuffer();
}

View File

@ -163,7 +163,6 @@ DeclareSciCallR0(GetPositionCache, GETPOSITIONCACHE, int);
DeclareSciCallV1(SetPositionCache, SETPOSITIONCACHE, int, cache);
DeclareSciCallR0(GetLayoutThreads, GETLAYOUTTHREADS, int);
DeclareSciCallV1(SetLayoutThreads, SETLAYOUTTHREADS, int, threads);
// Event Masks
DeclareSciCallR0(GetModEventMask, GETMODEVENTMASK, int);
DeclareSciCallV1(SetModEventMask, SETMODEVENTMASK, int, mask);
@ -411,6 +410,12 @@ DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, char *const, DocPos, start, D
DeclareSciCallR2(GetLine, GETLINE, DocPos, DocLn, line, const char*, text);
DeclareSciCallR2(GetCurLine, GETCURLINE, DocPos, unsigned int, length, const char*, text); // NULL: w/o terminating '\0' (SCI v515)
// change history
DeclareSciCallV1(SetChangeHistory, SETCHANGEHISTORY, int, changeHistory);
DeclareSciCallR0(GetChangeHistory, GETCHANGEHISTORY, int);
//=============================================================================
inline DocPos SciCall_GetLine_Safe(DocLn iLine, char* pTxtBuf)
{
DocPos const iLen = SciCall_GetLine(iLine, pTxtBuf);

View File

@ -277,16 +277,16 @@ static inline int MapFQNameToSciFontQuality(LPCWSTR fqName) {
//=============================================================================
// ensure to be consistent with
static WCHAR* IndicatorTypes[22] = {
static WCHAR* IndicatorTypes[23] = {
L"indic_plain", // 0 INDIC_PLAIN
L"indic_squiggle", // 1 INDIC_SQUIGGLE
L"indic_tt", // 2 INDIC_TT
L"indic_diagonal", // 3 INDIC_DIAGONAL
L"indic_strike", // 4 INDIC_STRIKE 4
L"indic_hidden", // 5 INDIC_HIDDEN 5
L"indic_box", // 6 INDIC_BOX 6
L"indic_roundbox", // 7 INDIC_ROUNDBOX 7
L"indic_straightbox", // 8 INDIC_STRAIGHTBOX 8
L"indic_strike", // 4 INDIC_STRIKE
L"indic_hidden", // 5 INDIC_HIDDEN
L"indic_box", // 6 INDIC_BOX
L"indic_roundbox", // 7 INDIC_ROUNDBOX
L"indic_straightbox", // 8 INDIC_STRAIGHTBOX
L"indic_dash", // 9 INDIC_DASH
L"indic_dots", // 10 INDIC_DOTS
L"indic_squigglelow", // 11 INDIC_SQUIGGLELOW
@ -299,7 +299,8 @@ static WCHAR* IndicatorTypes[22] = {
L"indic_point", // 18 INDIC_POINT
L"indic_pointcharacter", // 19 INDIC_POINTCHARACTER
L"indic_gradient", // 20 INDIC_GRADIENT
L"indic_gradientcentre" // 21 INDIC_GRADIENTCENTRE
L"indic_gradientcentre", // 21 INDIC_GRADIENTCENTRE
L"indic_point_top" // 22 INDIC_POINT_TOP
};
static inline bool HasIndicStyleStrokeWidth(const int indicStyle) {
@ -1595,6 +1596,9 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
// bookmark line or marker
Style_SetBookmark(hwnd, Settings.ShowBookmarkMargin);
// Change History
Style_SetChangeHistory(hwnd, Settings.ShowChangeHistoryMargin);
// Hyperlink (URL) indicators
Style_SetUrlHotSpot(hwnd);
@ -2054,6 +2058,16 @@ void Style_SetBookmark(HWND hwnd, bool bShowMargin)
}
//=============================================================================
//
// Style_SetChangeHistory()
//
void Style_SetChangeHistory(HWND hwnd, bool bShowMargin)
{
SciCall_SetMarginWidthN(MARGIN_SCI_CHGHIST, (bShowMargin ? _GetMarkerMarginWidth(hwnd) : 0));
}
//=============================================================================
//
// Style_SetMargin()
@ -2077,13 +2091,23 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
}
COLORREF const clrMarginBack = colorRead;
COLORREF fldHiLight = clrLineNumFore;
const WCHAR* wchHighlightStyleStrg = GetCurrentStdLexer()->Styles[STY_SEL_TXT].szValue;
Style_StrGetColor(wchHighlightStyleStrg, FOREGROUND_LAYER, &fldHiLight, true);
COLORREF clrFoldMarginBack = clrMarginBack;
const WCHAR* wchDefaultStyleStrg = GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue;
Style_StrGetColor(wchDefaultStyleStrg, BACKGROUND_LAYER, &clrFoldMarginBack, true);
// --- Line Numbers ---
SciCall_StyleSetBack(STYLE_LINENUMBER, clrMarginBack);
SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrMarginBack);
//~SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrLineNumBack);
SciCall_SetMarginSensitiveN(MARGIN_SCI_LINENUM, false); /// (!) false: allow selection drag
// CallTips
// --- CallTips ---
SciCall_CallTipSetBack(clrMarginBack);
SciCall_CallTipSetFore(RGB(0x80, 0x80, 0x80));
SciCall_CallTipSetForeHlt(clrLineNumFore);
@ -2137,12 +2161,11 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
SciCall_SetMarginSensitiveN(MARGIN_SCI_BOOKMRK, true);
SciCall_SetMarginCursorN(MARGIN_SCI_BOOKMRK, SC_NP3_CURSORHAND);
// --- Change History ---
SciCall_SetMarginBackN(MARGIN_SCI_CHGHIST, clrMarginBack);
SciCall_SetMarginSensitiveN(MARGIN_SCI_CHGHIST, false);
// --- Code folding ---
COLORREF fldHiLight = clrLineNumFore;
const WCHAR* wchHighlightStyleStrg = GetCurrentStdLexer()->Styles[STY_SEL_TXT].szValue;
Style_StrGetColor(wchHighlightStyleStrg, FOREGROUND_LAYER, &fldHiLight, true);
SciCall_SetMarginBackN(MARGIN_SCI_FOLDING, clrMarginBack);
SciCall_SetMarginSensitiveN(MARGIN_SCI_FOLDING, true);
@ -2183,8 +2206,9 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
}
SciCall_MarkerEnableHighlight(true); // highlight folding block
SciCall_SetFoldMarginColour(true, clrMarginBack); // background
SciCall_SetFoldMarginHiColour(true, clrMarginBack); // (!)
// background
SciCall_SetFoldMarginColour(true, clrFoldMarginBack); // background
SciCall_SetFoldMarginHiColour(true, clrFoldMarginBack); // (!)
//SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_HIDDEN);
int fldStyleLn = 0;
@ -2207,6 +2231,7 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
// set width
Style_SetBookmark(hwnd, Settings.ShowBookmarkMargin);
Style_SetChangeHistory(hwnd, Settings.ShowChangeHistoryMargin);
Style_SetFolding(hwnd, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
}

View File

@ -24,8 +24,17 @@
#define MARGIN_SCI_LINENUM 0
#define MARGIN_SCI_BOOKMRK 1
#define MARGIN_SCI_FOLDING 2
#define NUMBER_OF_MARGINS 3
#define MARGIN_SCI_CHGHIST 2
#define MARGIN_SCI_FOLDING 3
#define NUMBER_OF_MARGINS 4
#define MARGIN_MARK_HISTORY_MASK ( \
(1 << SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN) | \
(1 << SC_MARKNUM_HISTORY_SAVED) | \
(1 << SC_MARKNUM_HISTORY_MODIFIED) | \
(1 << SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED) \
)
int Style_NumOfLexers(); // Number of Lexers in pLexArray
@ -56,6 +65,7 @@ void Style_SetInvisible(HWND hwnd, bool);
void Style_HighlightCurrentLine(HWND hwnd, int);
void Style_SetFolding(HWND hwnd, bool bShowMargin);
void Style_SetBookmark(HWND hwnd, bool bShowMargin);
void Style_SetChangeHistory(HWND hwnd, bool bShowMargin);
void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle);
bool Style_SetLexerFromFile(HWND hwnd,const HPATHL hpath);
bool Style_MaybeBinaryFile(HWND hwnd, const HPATHL hpath);

View File

@ -551,6 +551,7 @@ typedef struct SETTINGS_T {
int LongLinesLimit;
int LongLineMode;
bool ShowBookmarkMargin;
bool ShowChangeHistoryMargin;
bool ShowLineNumbers;
bool ShowCodeFolding;
bool MarkOccurrences;

View File

@ -9,12 +9,12 @@
#define VERSION_MAJOR 5
#define VERSION_MINOR 22
#define VERSION_REV 829
#define VERSION_BUILD 1
#define SCINTILLA_VER 520
#define LEXILLA_VER 515
#define VERSION_BUILD 2
#define SCINTILLA_VER 530
#define LEXILLA_VER 519
#define ONIGURUMA_REGEX_VER 6.9.8
#define UCHARDET_VER 2018.09.27
#define TINYEXPR_VER 2018.05.11
#define UTHASH_VER 2.3.0
#define VERSION_PATCH beta
#define VERSION_COMMIT_ID dkt1-amr
#define VERSION_PATCH LongPath
#define VERSION_COMMIT_ID metaneoc

View File

@ -10,7 +10,7 @@ addindex
#include <strsafe.h>
#include <shlobj.h>
// TODO: fkdlkldfdl
// TODO : fkdlkldfdl
// ----------------------------------------------------------------------------
@ -29,11 +29,11 @@ extern "C" WININFO s_WinInfo;
extern "C" WININFO s_DefWinInfo;
extern "C" const WCHAR* const TBBUTTON_DEFAULT_IDS_V1;
extern "C" const WCHAR* const TBBUTTON_DEFAULT_IDS_V2;
ext ern "C" const WCHAR* const TBBUTTON_DEFAULT_IDS_V2;
extern "C" prefix_t s_mxSBPrefix[STATUS_SECTOR_COUNT];
extern "C" prefix_t s_mxSBPostfix[STATUS_SECTOR_COUNT];
extern "C" bool s_iStatusbarVisible[STATUS_SECTOR_COUNT];
exte rn "C" bool s_iStatusbarVisible[STATUS_SECTOR_COUNT];
extern "C" int s_iStatusbarWidthSpec[STATUS_SECTOR_COUNT];
extern "C" int s_vSBSOrder[STATUS_SECTOR_COUNT];