From 4e3dd33f9c7ea1d833447b71970c77de54d57c2b Mon Sep 17 00:00:00 2001 From: donho Date: Fri, 20 Jun 2008 22:41:34 +0000 Subject: [PATCH] [NEW_FEATURE] Add Caret block mode. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@245 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 24 ++++++++++++------- PowerEditor/src/Notepad_plus.h | 10 ++++---- PowerEditor/src/Parameters.cpp | 3 --- PowerEditor/src/Parameters.h | 2 +- .../WinControls/Preference/preferenceDlg.cpp | 2 ++ 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 021d7235..3b9f7e97 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -5684,10 +5684,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _mainEditView.showIndentGuideLine(svp1._indentGuideLineShow); _subEditView.showIndentGuideLine(svp2._indentGuideLineShow); - _mainEditView.execute(SCI_SETCARETWIDTH, nppGUI._caretWidth); - _subEditView.execute(SCI_SETCARETWIDTH, nppGUI._caretWidth); - _mainEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate); - _subEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate); + ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0); _configStyleDlg.init(_hInst, _hSelf); _preference.init(_hInst, _hSelf); @@ -6895,15 +6892,26 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa return TRUE; } - case NPPM_INTERNAL_SETCARETWIDTH ://NPPM_INTERNAL_SCINTILLAKEYMODIFIED : + case NPPM_INTERNAL_SETCARETWIDTH : { NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); - _mainEditView.execute(SCI_SETCARETWIDTH, nppGUI._caretWidth); - _subEditView.execute(SCI_SETCARETWIDTH, nppGUI._caretWidth); + + if (nppGUI._caretWidth < 4) + { + _mainEditView.execute(SCI_SETCARETSTYLE, CARETSTYLE_LINE); + _subEditView.execute(SCI_SETCARETSTYLE, CARETSTYLE_LINE); + _mainEditView.execute(SCI_SETCARETWIDTH, nppGUI._caretWidth); + _subEditView.execute(SCI_SETCARETWIDTH, nppGUI._caretWidth); + } + else + { + _mainEditView.execute(SCI_SETCARETSTYLE, CARETSTYLE_BLOCK); + _subEditView.execute(SCI_SETCARETSTYLE, CARETSTYLE_BLOCK); + } return TRUE; } - case NPPM_INTERNAL_SETCARETBLINKRATE ://NPPM_INTERNAL_PLUGINCMDLIST_MODIFIED : + case NPPM_INTERNAL_SETCARETBLINKRATE : { NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); _mainEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 428e6f44..b1ed4d3c 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -691,8 +691,7 @@ private: bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible); - int getLangFromMenuName(const char * langName) - { + int getLangFromMenuName(const char * langName) { int id = 0; char menuLangName[ 16 ]; @@ -716,10 +715,9 @@ private: } return id; - } + }; - string getLangFromMenu(const Buffer * buf) - { + string getLangFromMenu(const Buffer * buf) { int id; const char * userLangName; char menuLangName[32]; @@ -736,7 +734,7 @@ private: userLangName = buf->getUserDefineLangName(); } return userLangName; - } + }; void setFileOpenSaveDlgFilters(FileDialog & fDlg); void markSelectedText(); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index d76c99a6..95bdf28b 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1101,9 +1101,6 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle) } } } - /* - - */ } } } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 2273db8e..5f7be1f4 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -358,7 +358,7 @@ public: void addStyler(int styleID, TiXmlNode *styleNode); void addStyler(int styleID, char *styleName) { - ZeroMemory(&_styleArray[_nbStyler], sizeof(Style));; + //ZeroMemory(&_styleArray[_nbStyler], sizeof(Style));; _styleArray[_nbStyler]._styleID = styleID; _styleArray[_nbStyler]._styleDesc = styleName; _styleArray[_nbStyler]._fgColor = black; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index d4c99dd3..2c9c27cb 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -316,6 +316,8 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)"1"); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)"2"); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)"3"); + ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)"Block"); + ::SendMessage(::GetDlgItem(_hSelf, IDC_WIDTH_COMBO), CB_SETCURSEL, nppGUI._caretWidth, 0);