Add support for Change History in the text

This commit follows the commit:
fd1f785b89

Close #14838
This commit is contained in:
Don Ho 2024-03-08 03:52:29 +01:00
parent 9d92b0a869
commit aa0be9973b
15 changed files with 201 additions and 73 deletions

View File

@ -1052,11 +1052,11 @@ Translation note:
<Item id="6292" name="Dynamic width"/> <Item id="6292" name="Dynamic width"/>
<Item id="6293" name="Constant width"/> <Item id="6293" name="Constant width"/>
<Item id="6207" name="Display bookmark"/> <Item id="6207" name="Display bookmark"/>
<Item id="6223" name="Display Change History"/> <Item id="6295" name="Change History"/>
<Item id="6223" name="Show in the margin"/>
<Item id="6296" name="Show in the text"/>
<Item id="6211" name="Vertical Edge Settings"/> <Item id="6211" name="Vertical Edge Settings"/>
<Item id="6213" name="Background mode"/> <Item id="6213" name="Background mode"/>
<Item id="6237" name="Add your column marker by indicating its position with a decimal number.
You can define several column markers by using white space to separate the different numbers."/>
<Item id="6231" name="Border Width"/> <Item id="6231" name="Border Width"/>
<Item id="6235" name="No edge"/> <Item id="6235" name="No edge"/>
<Item id="6208" name="Padding"/> <Item id="6208" name="Padding"/>
@ -1785,6 +1785,7 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
<npcCustomColor-tip value="Go to Style Configurator to change the default custom color for selected whitespace and non-printing characters (&quot;Non-printing characters custom color&quot;)."/> <npcCustomColor-tip value="Go to Style Configurator to change the default custom color for selected whitespace and non-printing characters (&quot;Non-printing characters custom color&quot;)."/>
<npcIncludeCcUniEol-tip value="Apply non-printing characters appearance settings to C0, C1 control and Unicode EOL (next line, line separator and paragraph separator) characters."/> <npcIncludeCcUniEol-tip value="Apply non-printing characters appearance settings to C0, C1 control and Unicode EOL (next line, line separator and paragraph separator) characters."/>
<searchingInSelThresh-tip value="Number of selected characters in edit zone to automatically check the &quot;In selection&quot; checkbox when the Find dialog is activated. The maximum value is 1024. Set the value to 0 to disable auto-checking."/> <searchingInSelThresh-tip value="Number of selected characters in edit zone to automatically check the &quot;In selection&quot; checkbox when the Find dialog is activated. The maximum value is 1024. Set the value to 0 to disable auto-checking."/>
<verticalEdge-tip value="Add your column marker by indicating its position with a decimal number. You can define several column markers by using white space to separate the different numbers."/>
</MiscStrings> </MiscStrings>
</Native-Langue> </Native-Langue>
</NotepadPlus> </NotepadPlus>

View File

@ -1052,11 +1052,11 @@ Translation note:
<Item id="6292" name="Dynamic width"/> <Item id="6292" name="Dynamic width"/>
<Item id="6293" name="Constant width"/> <Item id="6293" name="Constant width"/>
<Item id="6207" name="Display bookmark"/> <Item id="6207" name="Display bookmark"/>
<Item id="6223" name="Display Change History"/> <Item id="6295" name="Change History"/>
<Item id="6223" name="Show in the margin"/>
<Item id="6296" name="Show in the text"/>
<Item id="6211" name="Vertical Edge Settings"/> <Item id="6211" name="Vertical Edge Settings"/>
<Item id="6213" name="Background mode"/> <Item id="6213" name="Background mode"/>
<Item id="6237" name="Add your column marker by indicating its position with a decimal number.
You can define several column markers by using white space to separate the different numbers."/>
<Item id="6231" name="Border Width"/> <Item id="6231" name="Border Width"/>
<Item id="6235" name="No edge"/> <Item id="6235" name="No edge"/>
<Item id="6208" name="Padding"/> <Item id="6208" name="Padding"/>
@ -1779,6 +1779,7 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
<npcCustomColor-tip value="Go to Style Configurator to change the default custom color for selected whitespace and non-printing characters (&quot;Non-printing characters custom color&quot;)."/> <npcCustomColor-tip value="Go to Style Configurator to change the default custom color for selected whitespace and non-printing characters (&quot;Non-printing characters custom color&quot;)."/>
<npcIncludeCcUniEol-tip value="Apply non-printing characters appearance settings to C0, C1 control and Unicode EOL (next line, line separator and paragraph separator) characters."/> <npcIncludeCcUniEol-tip value="Apply non-printing characters appearance settings to C0, C1 control and Unicode EOL (next line, line separator and paragraph separator) characters."/>
<searchingInSelThresh-tip value="Number of selected characters in edit zone to automatically check the &quot;In selection&quot; checkbox when the Find dialog is activated. The maximum value is 1024. Set the value to 0 to disable auto-checking."/> <searchingInSelThresh-tip value="Number of selected characters in edit zone to automatically check the &quot;In selection&quot; checkbox when the Find dialog is activated. The maximum value is 1024. Set the value to 0 to disable auto-checking."/>
<verticalEdge-tip value="Add your column marker by indicating its position with a decimal number. You can define several column markers by using white space to separate the different numbers."/>
</MiscStrings> </MiscStrings>
</Native-Langue> </Native-Langue>
</NotepadPlus> </NotepadPlus>

View File

@ -1049,11 +1049,11 @@ Translation note:
<Item id="6292" name="Largeur dynamique"/> <Item id="6292" name="Largeur dynamique"/>
<Item id="6293" name="Largeur constante"/> <Item id="6293" name="Largeur constante"/>
<Item id="6207" name="Afficher la marge de signet"/> <Item id="6207" name="Afficher la marge de signet"/>
<Item id="6223" name="Afficher l'Historique de Modification"/> <Item id="6295" name="Historique de Modification"/>
<Item id="6223" name="Afficher dans la marge"/>
<Item id="6296" name="Afficher dans le texte"/>
<Item id="6211" name="Marqueur de colonne"/> <Item id="6211" name="Marqueur de colonne"/>
<Item id="6213" name="Colorer larrière-plan"/> <Item id="6213" name="Colorer larrière-plan"/>
<Item id="6237" name="Ajoutez votre marqueur de colonne en indiquant sa position avec un nombre entier.
Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour séparer les différents nombres."/>
<Item id="6231" name="Largeur de la bordure"/> <Item id="6231" name="Largeur de la bordure"/>
<Item id="6235" name="Pas de bordure"/> <Item id="6235" name="Pas de bordure"/>
<Item id="6208" name="Remplissage"/> <Item id="6208" name="Remplissage"/>
@ -1781,6 +1781,7 @@ Cliquez sur le bouton &quot;?&quot; à droite pour ouvrir le site web du Manuel
<npcCustomColor-tip value="Aller dans le Configurateur de style pour changer la couleur personnalisée par défaut pour la sélection de caractères blancs et de caractères non-imprimables (&quot;Couleur personnalisée des caractères non-imprimables&quot;)."/> <npcCustomColor-tip value="Aller dans le Configurateur de style pour changer la couleur personnalisée par défaut pour la sélection de caractères blancs et de caractères non-imprimables (&quot;Couleur personnalisée des caractères non-imprimables&quot;)."/>
<npcIncludeCcUniEol-tip value="Applique les paramètres d'apparence des caractères non-imprimables aux contrôles C0, C1 et aux caractères Unicode EOL (ligne suivante, séparateur de ligne et séparateur de paragraphe)."/> <npcIncludeCcUniEol-tip value="Applique les paramètres d'apparence des caractères non-imprimables aux contrôles C0, C1 et aux caractères Unicode EOL (ligne suivante, séparateur de ligne et séparateur de paragraphe)."/>
<searchingInSelThresh-tip value="Nombre de caractères sélectionnés dans la zone d'édition pour cocher automatiquement la case &quot;Dans la sélection&quot; quand la fenêtre Rechercher est activée. La valeur maximale est 1024. Mettre la valeur à 0 pour désactiver l'auto-coche."/> <searchingInSelThresh-tip value="Nombre de caractères sélectionnés dans la zone d'édition pour cocher automatiquement la case &quot;Dans la sélection&quot; quand la fenêtre Rechercher est activée. La valeur maximale est 1024. Mettre la valeur à 0 pour désactiver l'auto-coche."/>
<verticalEdge-tip value="Ajoutez votre marqueur de colonne en indiquant sa position avec un nombre entier. Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour séparer les différents nombres."/>
</MiscStrings> </MiscStrings>
</Native-Langue> </Native-Langue>
</NotepadPlus> </NotepadPlus>

View File

@ -1002,17 +1002,17 @@
<Item id="6203" name="箭頭"/> <Item id="6203" name="箭頭"/>
<Item id="6204" name="圓形"/> <Item id="6204" name="圓形"/>
<Item id="6205" name="方形"/> <Item id="6205" name="方形"/>
<Item id="6226" name="無"/> <Item id="6226" name="無"/>
<Item id="6291" name="行號"/> <Item id="6291" name="行號"/>
<Item id="6206" name="顯示"/> <Item id="6206" name="顯示"/>
<Item id="6292" name="動態寬度"/> <Item id="6292" name="動態寬度"/>
<Item id="6293" name="恆定寬度"/> <Item id="6293" name="恆定寬度"/>
<Item id="6207" name="顯示標記"/> <Item id="6207" name="顯示標記"/>
<Item id="6223" name="顯示文件修改紀錄"/> <Item id="6295" name="文件修改紀錄"/>
<Item id="6223" name="顯示在邊框上"/>
<Item id="6296" name="顯示在字裡行間"/>
<Item id="6211" name="行界線設定"/> <Item id="6211" name="行界線設定"/>
<Item id="6213" name="背景色模式"/> <Item id="6213" name="背景色模式"/>
<Item id="6237" name="如欲添加列標記可以在下面以數字指示其列位置。
使用空格分隔不同數字來定義多個列標記。"/>
<Item id="6231" name="邊框寬度"/> <Item id="6231" name="邊框寬度"/>
<Item id="6235" name="無邊框"/> <Item id="6235" name="無邊框"/>
<Item id="6208" name="填充"/> <Item id="6208" name="填充"/>
@ -1623,6 +1623,7 @@
2. 如果「停用自動換行」被啟動,在開啟一個大型文件時,「自動換行」將對所有文件停用。 你可以通過選單「檢視-&gt;自動換行」重新啟動這個功能。"/> 2. 如果「停用自動換行」被啟動,在開啟一個大型文件時,「自動換行」將對所有文件停用。 你可以通過選單「檢視-&gt;自動換行」重新啟動這個功能。"/>
<searchingInSelThresh-tip value="在尋找與取代對話方塊啟動時,為啟動自動勾選核取方塊「僅尋找選取範圍」在編輯區中選取的字符數量。 最大值為 1024。 將值設置為 0 將停止自動勾選功能。"/> <searchingInSelThresh-tip value="在尋找與取代對話方塊啟動時,為啟動自動勾選核取方塊「僅尋找選取範圍」在編輯區中選取的字符數量。 最大值為 1024。 將值設置為 0 將停止自動勾選功能。"/>
<verticalEdge-tip value="如欲添加列標記可以在下面以數字指示其列位置。使用空格分隔不同數字來定義多個列標記。"/>
</MiscStrings> </MiscStrings>
</Native-Langue> </Native-Langue>
</NotepadPlus> </NotepadPlus>

View File

@ -3152,19 +3152,40 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_ENABLECHANGEHISTORY: case NPPM_INTERNAL_ENABLECHANGEHISTORY:
{ {
static bool stopActionUntilNextSession = false;
const ScintillaViewParams& svp = nppParam.getSVP(); const ScintillaViewParams& svp = nppParam.getSVP();
int enabledCH = svp._isChangeHistoryEnabled ? (SC_CHANGE_HISTORY_ENABLED | SC_CHANGE_HISTORY_MARKERS) : SC_CHANGE_HISTORY_DISABLED;
_mainEditView.execute(SCI_SETCHANGEHISTORY, enabledCH); int enabledCHFlag = SC_CHANGE_HISTORY_DISABLED;
_subEditView.execute(SCI_SETCHANGEHISTORY, enabledCH); if (svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled)
{
enabledCHFlag = SC_CHANGE_HISTORY_ENABLED;
_mainEditView.showChangeHistoryMargin(svp._isChangeHistoryEnabled); if (svp._isChangeHistoryMarginEnabled)
_subEditView.showChangeHistoryMargin(svp._isChangeHistoryEnabled); enabledCHFlag |= SC_CHANGE_HISTORY_MARKERS;
enableCommand(IDM_SEARCH_CHANGED_PREV, svp._isChangeHistoryEnabled, MENU); if (svp._isChangeHistoryIndicatorEnabled)
enableCommand(IDM_SEARCH_CHANGED_NEXT, svp._isChangeHistoryEnabled, MENU); enabledCHFlag |= SC_CHANGE_HISTORY_INDICATORS;
enableCommand(IDM_SEARCH_CLEAR_CHANGE_HISTORY, svp._isChangeHistoryEnabled, MENU); }
if (!stopActionUntilNextSession)
{
_mainEditView.execute(SCI_SETCHANGEHISTORY, enabledCHFlag);
_subEditView.execute(SCI_SETCHANGEHISTORY, enabledCHFlag);
if (enabledCHFlag == SC_CHANGE_HISTORY_DISABLED)
stopActionUntilNextSession = true;
_mainEditView.showChangeHistoryMargin(svp._isChangeHistoryMarginEnabled);
_subEditView.showChangeHistoryMargin(svp._isChangeHistoryMarginEnabled);
_mainEditView.redraw();
_subEditView.redraw();
enableCommand(IDM_SEARCH_CHANGED_PREV, svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled, MENU);
enableCommand(IDM_SEARCH_CHANGED_NEXT, svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled, MENU);
enableCommand(IDM_SEARCH_CLEAR_CHANGE_HISTORY, svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled, MENU);
}
return TRUE; return TRUE;
} }

View File

@ -589,7 +589,8 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
// many settings such as update status bar, clickable link etc. // many settings such as update status bar, clickable link etc.
activateBuffer(id, currentView(), true); activateBuffer(id, currentView(), true);
if (NppParameters::getInstance().getSVP()._isChangeHistoryEnabled) auto svp = NppParameters::getInstance().getSVP();
if (svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled)
clearChangesHistory(); clearChangesHistory();
return res; return res;

View File

@ -6338,19 +6338,37 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
_svp._bookMarkMarginShow = false; _svp._bookMarkMarginShow = false;
} }
// Bookmark Margin // Change History Margin
nm = element->Attribute(TEXT("isChangeHistoryEnabled")); int chState = 0;
nm = element->Attribute(TEXT("isChangeHistoryEnabled"), &chState);
if (nm) if (nm)
{ {
if (!lstrcmp(nm, TEXT("yes"))) if (!lstrcmp(nm, TEXT("yes"))) // for the retro-compatibility
chState = 1;
_svp._isChangeHistoryEnabled4NextSession = static_cast<changeHistoryState>(chState);
switch (chState)
{ {
_svp._isChangeHistoryEnabled = true; case changeHistoryState::disable:
_svp._isChangeHistoryEnabled4NextSession = true; _svp._isChangeHistoryMarginEnabled = false;
} _svp._isChangeHistoryIndicatorEnabled = false;
else if (!lstrcmp(nm, TEXT("no"))) break;
{ case changeHistoryState::margin:
_svp._isChangeHistoryEnabled = false; _svp._isChangeHistoryMarginEnabled = true;
_svp._isChangeHistoryEnabled4NextSession = false; _svp._isChangeHistoryIndicatorEnabled = false;
break;
case changeHistoryState::indicator:
_svp._isChangeHistoryMarginEnabled = false;
_svp._isChangeHistoryIndicatorEnabled = true;
break;
case changeHistoryState::marginIndicator:
_svp._isChangeHistoryMarginEnabled = true;
_svp._isChangeHistoryIndicatorEnabled = true;
break;
default:
_svp._isChangeHistoryMarginEnabled = true;
_svp._isChangeHistoryIndicatorEnabled = false;
_svp._isChangeHistoryEnabled4NextSession = changeHistoryState::marginIndicator;
} }
} }
@ -6872,7 +6890,9 @@ bool NppParameters::writeScintillaParams()
(_svp._folderStyle == FOLDER_STYLE_CIRCLE)?TEXT("circle"): (_svp._folderStyle == FOLDER_STYLE_CIRCLE)?TEXT("circle"):
(_svp._folderStyle == FOLDER_STYLE_NONE)?TEXT("none"):TEXT("box"); (_svp._folderStyle == FOLDER_STYLE_NONE)?TEXT("none"):TEXT("box");
(scintNode->ToElement())->SetAttribute(TEXT("folderMarkStyle"), pFolderStyleStr); (scintNode->ToElement())->SetAttribute(TEXT("folderMarkStyle"), pFolderStyleStr);
(scintNode->ToElement())->SetAttribute(TEXT("isChangeHistoryEnabled"), _svp._isChangeHistoryEnabled4NextSession ? TEXT("yes") : TEXT("no"));
(scintNode->ToElement())->SetAttribute(TEXT("isChangeHistoryEnabled"), _svp._isChangeHistoryEnabled4NextSession); // no -> 0 (disable), yes -> 1 (margin), yes ->2 (indicator), yes-> 3 (margin + indicator)
const TCHAR *pWrapMethodStr = (_svp._lineWrapMethod == LINEWRAP_ALIGNED)?TEXT("aligned"): const TCHAR *pWrapMethodStr = (_svp._lineWrapMethod == LINEWRAP_ALIGNED)?TEXT("aligned"):
(_svp._lineWrapMethod == LINEWRAP_INDENT)?TEXT("indent"):TEXT("default"); (_svp._lineWrapMethod == LINEWRAP_INDENT)?TEXT("indent"):TEXT("default");
(scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr); (scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr);

View File

@ -942,8 +942,11 @@ struct ScintillaViewParams
bool _lineNumberMarginShow = true; bool _lineNumberMarginShow = true;
bool _lineNumberMarginDynamicWidth = true; bool _lineNumberMarginDynamicWidth = true;
bool _bookMarkMarginShow = true; bool _bookMarkMarginShow = true;
bool _isChangeHistoryEnabled = true;
bool _isChangeHistoryEnabled4NextSession = true; bool _isChangeHistoryMarginEnabled = true;
bool _isChangeHistoryIndicatorEnabled = false;
changeHistoryState _isChangeHistoryEnabled4NextSession = changeHistoryState::margin; // no -> 0 (disable), yes -> 1 (margin), yes ->2 (indicator), yes-> 3 (margin + indicator)
folderStyle _folderStyle = FOLDER_STYLE_BOX; //"simple", "arrow", "circle", "box" and "none" folderStyle _folderStyle = FOLDER_STYLE_BOX; //"simple", "arrow", "circle", "box" and "none"
lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED; lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED;
bool _foldMarginShow = true; bool _foldMarginShow = true;

View File

@ -2236,8 +2236,19 @@ void ScintillaEditView::activateBuffer(BufferID buffer, bool force)
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const ScintillaViewParams& svp = nppParam.getSVP(); const ScintillaViewParams& svp = nppParam.getSVP();
int enabledCH = svp._isChangeHistoryEnabled ? (SC_CHANGE_HISTORY_ENABLED | SC_CHANGE_HISTORY_MARKERS) : SC_CHANGE_HISTORY_DISABLED;
execute(SCI_SETCHANGEHISTORY, enabledCH); int enabledCHFlag = SC_CHANGE_HISTORY_DISABLED;
if (svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled)
{
enabledCHFlag = SC_CHANGE_HISTORY_ENABLED;
if (svp._isChangeHistoryMarginEnabled)
enabledCHFlag |= SC_CHANGE_HISTORY_MARKERS;
if (svp._isChangeHistoryIndicatorEnabled)
enabledCHFlag |= SC_CHANGE_HISTORY_INDICATORS;
}
execute(SCI_SETCHANGEHISTORY, enabledCHFlag);
if (isTextDirectionRTL() != buffer->isRTL()) if (isTextDirectionRTL() != buffer->isRTL())
changeTextDirection(buffer->isRTL()); changeTextDirection(buffer->isRTL());

View File

@ -15,11 +15,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef SCINTILLA_REF_H #pragma once
#define SCINTILLA_REF_H
enum changeHistoryState { disable = 0, margin = 1, indicator = 2, marginIndicator = 3 };
enum folderStyle {FOLDER_TYPE, FOLDER_STYLE_SIMPLE, FOLDER_STYLE_ARROW, FOLDER_STYLE_CIRCLE, FOLDER_STYLE_BOX, FOLDER_STYLE_NONE}; enum folderStyle {FOLDER_TYPE, FOLDER_STYLE_SIMPLE, FOLDER_STYLE_ARROW, FOLDER_STYLE_CIRCLE, FOLDER_STYLE_BOX, FOLDER_STYLE_NONE};
enum lineWrapMethod {LINEWRAP_DEFAULT, LINEWRAP_ALIGNED, LINEWRAP_INDENT}; enum lineWrapMethod {LINEWRAP_DEFAULT, LINEWRAP_ALIGNED, LINEWRAP_INDENT};
enum lineHiliteMode {LINEHILITE_NONE, LINEHILITE_HILITE, LINEHILITE_FRAME}; enum lineHiliteMode {LINEHILITE_NONE, LINEHILITE_HILITE, LINEHILITE_FRAME};
#endif //SCINTILLA_REF_H

View File

@ -939,7 +939,7 @@ std::pair<intptr_t, intptr_t> WordStyleDlg::goToPreferencesSettings()
else if (style._styleDesc == TEXT("Change History margin")) else if (style._styleDesc == TEXT("Change History margin"))
{ {
result.first = 3; result.first = 3;
result.second = IDC_CHECK_CHANGHISTORYMARGE; result.second = IDC_CHECK_CHANGHISTORYMARGIN;
} }
else if (style._styleDesc == TEXT("Fold") || style._styleDesc == TEXT("Fold active") || style._styleDesc == TEXT("Fold margin")) else if (style._styleDesc == TEXT("Fold") || style._styleDesc == TEXT("Fold active") || style._styleDesc == TEXT("Fold margin"))
{ {

View File

@ -162,6 +162,7 @@ BEGIN
PUSHBUTTON "Reset",IDD_CUSTOMIZED_RESET_BUTTON,340,158,45,14 PUSHBUTTON "Reset",IDD_CUSTOMIZED_RESET_BUTTON,340,158,45,14
END END
IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE DIALOGEX 115, 10, 460, 205 IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE DIALOGEX 115, 10, 460, 205
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
@ -172,20 +173,26 @@ BEGIN
CONTROL "Circle tree",IDC_RADIO_CIRCLE,"Button",BS_AUTORADIOBUTTON,31,63,62,10 CONTROL "Circle tree",IDC_RADIO_CIRCLE,"Button",BS_AUTORADIOBUTTON,31,63,62,10
CONTROL "None",IDC_RADIO_FOLDMARGENONE,"Button",BS_AUTORADIOBUTTON,31,92,61,10 CONTROL "None",IDC_RADIO_FOLDMARGENONE,"Button",BS_AUTORADIOBUTTON,31,92,61,10
CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,31,77,61,10 CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,31,77,61,10
GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,116,21,148,136,BS_CENTER
LTEXT "Add your column marker by indicating its position with a decimal number.\nYou can define several column markers by using white space to separate the different numbers.",IDC_STATIC_MULTILNMODE_TIP,124,36,134,55 GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,22,121,83,47,BS_CENTER
EDITTEXT IDC_COLUMNPOS_EDIT,126,93,125,36,ES_MULTILINE CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,24,134,67,13
CONTROL "Background mode",IDC_CHECK_EDGEBGMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,138,122,10 LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,92,135,12,8
GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,22,112,83,45,BS_CENTER CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,151,60,10
CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,24,125,67,13
LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,92,126,12,8 GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,116,21,148,89,BS_CENTER
CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,142,60,10 PUSHBUTTON "?",IDC_BUTTON_VES_TIP,181,33,16,14,NOT WS_TABSTOP
EDITTEXT IDC_COLUMNPOS_EDIT,126,51,125,36,ES_MULTILINE
CONTROL "Background mode",IDC_CHECK_EDGEBGMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,94,122,10
GROUPBOX "Change History",IDC_GB_CHANGHISTORY,116,121,148,47,BS_CENTER
CONTROL "Show in the margin",IDC_CHECK_CHANGHISTORYMARGIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,135,140,10
CONTROL "Show in the text",IDC_CHECK_CHANGHISTORYINDICATOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,150,140,10
GROUPBOX "Line Number",IDC_LINENUMBERMARGE_GB_STATIC,274,21,135,66,BS_CENTER GROUPBOX "Line Number",IDC_LINENUMBERMARGE_GB_STATIC,274,21,135,66,BS_CENTER
CONTROL "Display",IDC_CHECK_LINENUMBERMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,35,85,10 CONTROL "Display",IDC_CHECK_LINENUMBERMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,35,85,10
CONTROL "Dynamic width",IDC_RADIO_DYNAMIC,"Button",BS_AUTORADIOBUTTON | WS_GROUP,293,51,110,10 CONTROL "Dynamic width",IDC_RADIO_DYNAMIC,"Button",BS_AUTORADIOBUTTON | WS_GROUP,293,51,110,10
CONTROL "Constant width",IDC_RADIO_CONSTANT,"Button",BS_AUTORADIOBUTTON,293,65,108,10 CONTROL "Constant width",IDC_RADIO_CONSTANT,"Button",BS_AUTORADIOBUTTON,293,65,108,10
CONTROL "Display Change History",IDC_CHECK_CHANGHISTORYMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,163,150,10
CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,163,150,10
GROUPBOX "Padding",IDC_PADDING_STATIC,274,94,135,63,BS_CENTER GROUPBOX "Padding",IDC_PADDING_STATIC,274,94,135,63,BS_CENTER
RTEXT "Left",IDC_PADDINGLEFT_STATIC,280,108,45,8 RTEXT "Left",IDC_PADDINGLEFT_STATIC,280,108,45,8
CONTROL "",IDC_PADDINGLEFT_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,328,107,67,13 CONTROL "",IDC_PADDINGLEFT_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,328,107,67,13
@ -196,6 +203,8 @@ BEGIN
RTEXT "Distraction Free",IDC_DISTRACTIONFREE_STATIC,275,140,72,8 RTEXT "Distraction Free",IDC_DISTRACTIONFREE_STATIC,275,140,72,8
CONTROL "",IDC_DISTRACTIONFREE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,348,139,47,13 CONTROL "",IDC_DISTRACTIONFREE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,348,139,47,13
LTEXT "0",IDC_DISTRACTIONFREEVAL_STATIC,396,140,12,8 LTEXT "0",IDC_DISTRACTIONFREEVAL_STATIC,396,140,12,8
CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,163,150,10
END END

View File

@ -241,6 +241,9 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (_editing2SubDlg._tip != nullptr) if (_editing2SubDlg._tip != nullptr)
NppDarkMode::setDarkTooltips(_editing2SubDlg._tip, NppDarkMode::ToolTipsType::tooltip); NppDarkMode::setDarkTooltips(_editing2SubDlg._tip, NppDarkMode::ToolTipsType::tooltip);
if (_marginsBorderEdgeSubDlg._verticalEdgeTip != nullptr)
NppDarkMode::setDarkTooltips(_marginsBorderEdgeSubDlg._verticalEdgeTip, NppDarkMode::ToolTipsType::tooltip);
for (auto& tip : _editing2SubDlg._tips) for (auto& tip : _editing2SubDlg._tips)
{ {
if (tip != nullptr) if (tip != nullptr)
@ -1130,13 +1133,13 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /*lParam*/) intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /*lParam*/)
{ {
NppParameters& nppParam = NppParameters::getInstance();
ScintillaViewParams& svp = (ScintillaViewParams&)nppParam.getSVP();
switch (message) switch (message)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
NppParameters& nppParam = NppParameters::getInstance();
ScintillaViewParams& svp = const_cast<ScintillaViewParams&>(nppParam.getSVP());
// defaul => (svp._eolMode == svp.roundedRectangleText) // defaul => (svp._eolMode == svp.roundedRectangleText)
bool checkDefaultCRLF = true; bool checkDefaultCRLF = true;
bool checkPlainTextCRLF = false; bool checkPlainTextCRLF = false;
@ -1164,14 +1167,12 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_RADIO_PLEINTEXT_CRLF, BM_SETCHECK, checkPlainTextCRLF, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_PLEINTEXT_CRLF, BM_SETCHECK, checkPlainTextCRLF, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_WITHCUSTOMCOLOR_CRLF, BM_SETCHECK, checkWithColorCRLF, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_WITHCUSTOMCOLOR_CRLF, BM_SETCHECK, checkWithColorCRLF, 0);
NppParameters& nppParam = NppParameters::getInstance();
ScintillaViewParams& svp = const_cast<ScintillaViewParams&>(nppParam.getSVP());
::SendDlgItemMessage(_hSelf, IDC_CHECK_MULTISELECTION, BM_SETCHECK, svp._multiSelection, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_MULTISELECTION, BM_SETCHECK, svp._multiSelection, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_COLUMN2MULTIEDITING, BM_SETCHECK, svp._columnSel2MultiEdit, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_COLUMN2MULTIEDITING, BM_SETCHECK, svp._columnSel2MultiEdit, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_COLUMN2MULTIEDITING), svp._multiSelection); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_COLUMN2MULTIEDITING), svp._multiSelection);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("eol-custom-color-tip", TEXT("Go to Style Configurator to change the default EOL custom color (\"EOL custom color\").")); generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("eol-custom-color-tip", TEXT("Go to Style Configurator to change the default EOL custom color (\"EOL custom color\")."));
_tip = CreateToolTip(IDC_BUTTON_LAUNCHSTYLECONF_CRLF, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()), pNativeSpeaker->isRTL()); _tip = CreateToolTip(IDC_BUTTON_LAUNCHSTYLECONF_CRLF, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()), pNativeSpeaker->isRTL());
@ -1910,7 +1911,8 @@ void MarginsBorderEdgeSubDlg::initScintParam()
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_CONSTANT), svp._lineNumberMarginShow); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_CONSTANT), svp._lineNumberMarginShow);
::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYMARGE, BM_SETCHECK, svp._isChangeHistoryEnabled, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYMARGIN, BM_SETCHECK, svp._isChangeHistoryMarginEnabled, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYINDICATOR, BM_SETCHECK, svp._isChangeHistoryIndicatorEnabled, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_NOEDGE, BM_SETCHECK, !svp._showBorderEdge, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_NOEDGE, BM_SETCHECK, !svp._showBorderEdge, 0);
bool canBeBg = svp._edgeMultiColumnPos.size() == 1; bool canBeBg = svp._edgeMultiColumnPos.size() == 1;
@ -1940,6 +1942,8 @@ void MarginsBorderEdgeSubDlg::initScintParam()
intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
static bool changeHistoryWarningHasBeenGiven = false;
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -1969,6 +1973,15 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
::SendMessage(::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER), TBM_SETPOS, TRUE, svp._distractionFreeDivPart); ::SendMessage(::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER), TBM_SETPOS, TRUE, svp._distractionFreeDivPart);
::SetDlgItemInt(_hSelf, IDC_DISTRACTIONFREEVAL_STATIC, svp._distractionFreeDivPart, FALSE); ::SetDlgItemInt(_hSelf, IDC_DISTRACTIONFREEVAL_STATIC, svp._distractionFreeDivPart, FALSE);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("verticalEdge-tip", L"Add your column marker by indicating its position with a decimal number. You can define several column markers by using white space to separate the different numbers.");
_verticalEdgeTip = CreateToolTip(IDC_BUTTON_VES_TIP, _hSelf, _hInst, const_cast<PTSTR>(tipNote2Show.c_str()), pNativeSpeaker->isRTL());
if (_verticalEdgeTip != nullptr)
{
// Make tip stay 30 seconds
::SendMessage(_verticalEdgeTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((30000), (0)));
}
initScintParam(); initScintParam();
return TRUE; return TRUE;
@ -2055,23 +2068,65 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_SYMBOLMARGIN, 0); ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_SYMBOLMARGIN, 0);
return TRUE; return TRUE;
case IDC_CHECK_CHANGHISTORYMARGE: case IDC_CHECK_CHANGHISTORYMARGIN:
{ {
bool isChangeHistoryEnabled = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYMARGE, BM_GETCHECK, 0, 0)); bool isMaginJustEnabled = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYMARGIN, BM_GETCHECK, 0, 0));
if (isChangeHistoryEnabled) bool isIndicatorAlreadyEnabled = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYINDICATOR, BM_GETCHECK, 0, 0));
if (isMaginJustEnabled && !isIndicatorAlreadyEnabled) // In the case that both "in margin" & "in text" were disabled, but "in margin" is just enabled
{ {
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker(); if (!changeHistoryWarningHasBeenGiven)
pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning", {
_hSelf, NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
TEXT("You have to restart Notepad++ to enable Change History."), pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning",
TEXT("Notepad++ need to be relaunched"), _hSelf,
MB_OK | MB_APPLMODAL); TEXT("You have to restart Notepad++ to enable Change History."),
svp._isChangeHistoryEnabled4NextSession = true; TEXT("Notepad++ need to be relaunched"),
MB_OK | MB_APPLMODAL);
changeHistoryWarningHasBeenGiven = true;
}
svp._isChangeHistoryMarginEnabled = true;
svp._isChangeHistoryEnabled4NextSession = changeHistoryState::margin;
}
else // otherwise
{
svp._isChangeHistoryMarginEnabled = isMaginJustEnabled;
svp._isChangeHistoryEnabled4NextSession = (!isMaginJustEnabled && !isIndicatorAlreadyEnabled) ? changeHistoryState::disable :
(isMaginJustEnabled && isIndicatorAlreadyEnabled) ? changeHistoryState::marginIndicator :changeHistoryState::indicator;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_ENABLECHANGEHISTORY, 0, 0);
}
return TRUE;
}
case IDC_CHECK_CHANGHISTORYINDICATOR:
{
bool isIndicatorJustEnabled = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYINDICATOR, BM_GETCHECK, 0, 0));
bool isMaginAlreadyEnabled = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CHANGHISTORYMARGIN, BM_GETCHECK, 0, 0));
if (isIndicatorJustEnabled && !isMaginAlreadyEnabled) // In the case that both "in margin" & "in text" were disabled, but "in text" is just enabled
{
if (!changeHistoryWarningHasBeenGiven)
{
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning",
_hSelf,
TEXT("You have to restart Notepad++ to enable Change History."),
TEXT("Notepad++ need to be relaunched"),
MB_OK | MB_APPLMODAL);
changeHistoryWarningHasBeenGiven = true;
}
svp._isChangeHistoryIndicatorEnabled = true;
svp._isChangeHistoryEnabled4NextSession = changeHistoryState::indicator;
} }
else else
{ {
svp._isChangeHistoryEnabled = false; svp._isChangeHistoryIndicatorEnabled = isIndicatorJustEnabled;
svp._isChangeHistoryEnabled4NextSession = false; svp._isChangeHistoryEnabled4NextSession = (!isIndicatorJustEnabled && !isMaginAlreadyEnabled) ? changeHistoryState::disable :
(isIndicatorJustEnabled && isMaginAlreadyEnabled) ? changeHistoryState::marginIndicator : changeHistoryState::margin;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_ENABLECHANGEHISTORY, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_ENABLECHANGEHISTORY, 0, 0);
} }
return TRUE; return TRUE;

View File

@ -115,10 +115,13 @@ private:
class MarginsBorderEdgeSubDlg : public StaticDialog class MarginsBorderEdgeSubDlg : public StaticDialog
{ {
friend class PreferenceDlg;
public : public :
MarginsBorderEdgeSubDlg() = default; MarginsBorderEdgeSubDlg() = default;
private : private :
HWND _verticalEdgeTip = nullptr;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
void initScintParam(); void initScintParam();
}; };

View File

@ -122,7 +122,7 @@
#define IDC_CARETBLINKRATE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 20) #define IDC_CARETBLINKRATE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 20)
#define IDC_CARETBLINKRATE_F_STATIC (IDD_PREFERENCE_SUB_EDITING + 21) #define IDC_CARETBLINKRATE_F_STATIC (IDD_PREFERENCE_SUB_EDITING + 21)
#define IDC_CARETBLINKRATE_S_STATIC (IDD_PREFERENCE_SUB_EDITING + 22) #define IDC_CARETBLINKRATE_S_STATIC (IDD_PREFERENCE_SUB_EDITING + 22)
#define IDC_CHECK_CHANGHISTORYMARGE (IDD_PREFERENCE_SUB_EDITING + 23) #define IDC_CHECK_CHANGHISTORYMARGIN (IDD_PREFERENCE_SUB_EDITING + 23)
#define IDC_DISTRACTIONFREE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 24) #define IDC_DISTRACTIONFREE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 24)
//#define IDC_CHECK_MULTISELECTION (IDD_PREFERENCE_SUB_EDITING + 25) //#define IDC_CHECK_MULTISELECTION (IDD_PREFERENCE_SUB_EDITING + 25)
@ -205,6 +205,9 @@
#define IDC_LINENUMBERMARGE_GB_STATIC (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 1) #define IDC_LINENUMBERMARGE_GB_STATIC (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 1)
#define IDC_RADIO_DYNAMIC (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 2) #define IDC_RADIO_DYNAMIC (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 2)
#define IDC_RADIO_CONSTANT (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 3) #define IDC_RADIO_CONSTANT (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 3)
#define IDC_BUTTON_VES_TIP (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 4)
#define IDC_GB_CHANGHISTORY (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 5)
#define IDC_CHECK_CHANGHISTORYINDICATOR (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 6)
#define IDD_PREFERENCE_SUB_MISC 6300 //(IDD_PREFERENCE_BOX + 300) #define IDD_PREFERENCE_SUB_MISC 6300 //(IDD_PREFERENCE_BOX + 300)
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SUB_MISC + 1) #define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SUB_MISC + 1)