[NEW] Make line change state margin customizable (show/hide).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@432 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2009-03-01 17:03:42 +00:00
parent a0c490719c
commit 06301c159f
7 changed files with 53 additions and 22 deletions

View File

@ -2045,7 +2045,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
prevWasEdit = false;
}
if (!_isFileOpening)
if (!_isFileOpening /*&& _pEditView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER)*/)
{
bool isProcessed = false;
@ -2884,6 +2884,7 @@ void Notepad_plus::specialCmd(int id, int param)
{
case IDM_VIEW_LINENUMBER:
case IDM_VIEW_SYMBOLMARGIN:
case IDM_VIEW_DOCCHANGEMARGIN:
case IDM_VIEW_FOLDERMAGIN:
{
int margin;
@ -2891,8 +2892,10 @@ void Notepad_plus::specialCmd(int id, int param)
margin = ScintillaEditView::_SC_MARGE_LINENUMBER;
else if (id == IDM_VIEW_SYMBOLMARGIN)
margin = ScintillaEditView::_SC_MARGE_SYBOLE;
else
margin = ScintillaEditView::_SC_MARGE_FOLDER;
else if (id == IDM_VIEW_DOCCHANGEMARGIN)
margin = ScintillaEditView::_SC_MARGE_MODIFMARKER;
else
margin = ScintillaEditView::_SC_MARGE_FOLDER;
if (pEditView->hasMarginShowed(margin))
pEditView->showMargin(margin, false);
@ -6623,6 +6626,7 @@ bool Notepad_plus::saveScintillaParams(bool whichOne)
svp._lineNumberMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_LINENUMBER);
svp._bookMarkMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_SYBOLE);
svp._docChangeStateMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER);
svp._indentGuideLineShow = pView->isShownIndentGuide();
svp._folderStyle = pView->getFolderStyle();
svp._currentLineHilitingShow = pView->isCurrentLineHiLiting();
@ -6843,6 +6847,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp2._lineNumberMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp2._bookMarkMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_MODIFMARKER, svp1._docChangeStateMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_MODIFMARKER, svp2._docChangeStateMarginShow);
_mainEditView.showIndentGuideLine(svp1._indentGuideLineShow);
_subEditView.showIndentGuideLine(svp2._indentGuideLineShow);

View File

@ -3214,6 +3214,17 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
_svp[whichOne]._bookMarkMarginShow = false;
}
// doc change state Margin
nm = element->Attribute(TEXT("docChangeStateMargin"));
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._docChangeStateMarginShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._docChangeStateMarginShow = false;
}
// Indent GuideLine
nm = element->Attribute(TEXT("indentGuideLine"));
if (nm)
@ -3415,6 +3426,7 @@ bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp, bool w
(scintNode->ToElement())->SetAttribute(TEXT("lineNumberMargin"), svp._lineNumberMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("bookMarkMargin"), svp._bookMarkMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("docChangeStateMargin"), svp._docChangeStateMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("indentGuideLine"), svp._indentGuideLineShow?TEXT("show"):TEXT("hide"));
const TCHAR *pFolderStyleStr = (svp._folderStyle == FOLDER_STYLE_SIMPLE)?TEXT("simple"):
(svp._folderStyle == FOLDER_STYLE_ARROW)?TEXT("arrow"):

View File

@ -621,12 +621,13 @@ struct NppGUI
struct ScintillaViewParams
{
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true), \
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true), _docChangeStateMarginShow(true),\
_folderStyle(FOLDER_STYLE_BOX), _indentGuideLineShow(true),\
_currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false),\
_zoom(0), _whiteSpaceShow(false), _eolShow(false){};
bool _lineNumberMarginShow;
bool _bookMarkMarginShow;
bool _docChangeStateMarginShow;
folderStyle _folderStyle; //"simple", TEXT("arrow"), TEXT("circle") and "box"
bool _indentGuideLineShow;
bool _currentLineHilitingShow;

View File

@ -64,26 +64,28 @@ END
IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 392, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Folder margin style",IDC_FMS_GB_STATIC,32,75,149,42,BS_CENTER
CONTROL "Simple",IDC_RADIO_SIMPLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,41,88,59,10
CONTROL "Arrow",IDC_RADIO_ARROW,"Button",BS_AUTORADIOBUTTON,41,102,60,10
CONTROL "Circle tree",IDC_RADIO_CIRCLE,"Button",BS_AUTORADIOBUTTON,114,88,62,10
CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,114,102,61,10
GROUPBOX "Folder margin style",IDC_FMS_GB_STATIC,32,69,149,42,BS_CENTER
CONTROL "Simple",IDC_RADIO_SIMPLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,41,82,59,10
CONTROL "Arrow",IDC_RADIO_ARROW,"Button",BS_AUTORADIOBUTTON,41,96,60,10
CONTROL "Circle tree",IDC_RADIO_CIRCLE,"Button",BS_AUTORADIOBUTTON,114,82,62,10
CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,114,96,61,10
CONTROL "Display line number margin",IDC_CHECK_LINENUMBERMARGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,123,141,10
CONTROL "Display bookmark margin",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,135,150,10
CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,87,122,10
RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,207,135,83,8
LTEXT "0",IDC_COLONENUMBER_STATIC,297,134,18,8
GROUPBOX "Vertical Edge Setting",IDC_VES_GB_STATIC,201,75,148,77,BS_CENTER
CONTROL "Line mode",IDC_RADIO_LNMODE,"Button",BS_AUTORADIOBUTTON,215,103,91,10
CONTROL "Background mode",IDC_RADIO_BGMODE,"Button",BS_AUTORADIOBUTTON,215,117,91,10
CONTROL "Active current line highlight",IDC_CHECK_CURRENTLINEHILITE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,148,129,10
GROUPBOX "",IDC_STATIC,20,60,350,104,0,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE
COMBOBOX IDC_COMBO_SCINTILLAVIEWCHOIX,139,57,96,40,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,117,141,10
CONTROL "Display bookmark margin",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,129,150,10
CONTROL "Display line change state margin",IDC_CHECK_DOCCHANGESTATEMARGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,141,162,10
CONTROL "Enable current line highlight",IDC_CHECK_CURRENTLINEHILITE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,153,129,10
CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,81,122,10
RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,207,129,83,8
LTEXT "0",IDC_COLONENUMBER_STATIC,297,128,18,8
GROUPBOX "Vertical Edge Setting",IDC_VES_GB_STATIC,201,69,148,77,BS_CENTER
CONTROL "Line mode",IDC_RADIO_LNMODE,"Button",BS_AUTORADIOBUTTON,215,97,91,10
CONTROL "Background mode",IDC_RADIO_BGMODE,"Button",BS_AUTORADIOBUTTON,215,111,91,10
GROUPBOX "",IDC_STATIC,20,54,350,118,0,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE
COMBOBOX IDC_COMBO_SCINTILLAVIEWCHOIX,139,51,96,40,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Caret settings",IDC_CARETSETTING_STATIC,23,5,199,40,BS_CENTER
LTEXT "Width :",IDC_WIDTH_STATIC,27,24,37,8,0,WS_EX_RIGHT
COMBOBOX IDC_WIDTH_COMBO,66,22,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -97,6 +99,7 @@ BEGIN
LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,121,29,12,8,0,WS_EX_RIGHT
END
IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 370, 180
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1

View File

@ -347,6 +347,7 @@ void MarginsDlg::changePanelTo(int index)
::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_SETCHECK, svp._lineNumberMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCCHANGESTATEMARGE, BM_SETCHECK, svp._docChangeStateMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0);
bool isEnable = !(svp._edgeMode == EDGE_NONE);
@ -455,6 +456,12 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam
svp._bookMarkMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_SYMBOLMARGIN, iView);
return TRUE;
case IDC_CHECK_DOCCHANGESTATEMARGE:
svp._docChangeStateMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCCHANGESTATEMARGE, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_DOCCHANGEMARGIN, iView);
return TRUE;
case IDC_CHECK_CURRENTLINEHILITE:
svp._currentLineHilitingShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, iView);

View File

@ -75,6 +75,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_CARETBLINKRATE_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 20)
#define IDC_CARETBLINKRATE_F_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 21)
#define IDC_CARETBLINKRATE_S_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 22)
#define IDC_CHECK_DOCCHANGESTATEMARGE (IDD_PREFERENCE_MARGEIN_BOX + 23)
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)

View File

@ -155,6 +155,7 @@
#define IDM_VIEW_HIDELINES (IDM_VIEW + 42)
#define IDM_VIEW_DRAWTABBAR_VERTICAL (IDM_VIEW + 43)
#define IDM_VIEW_DRAWTABBAR_MULTILINE (IDM_VIEW + 44)
#define IDM_VIEW_DOCCHANGEMARGIN (IDM_VIEW + 45)
#define IDM_VIEW_FOLD (IDM_VIEW + 50)