[ENHANCEMENT] (Author: Dave Brotherstone) Style clickable links only in current page instead of on whole documents.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@911 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-05-25 23:40:44 +00:00
parent efc33d6c06
commit 07f9ab578f
4 changed files with 27 additions and 6 deletions

View File

@ -122,7 +122,8 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N
_pMainSplitter(NULL), _pMainSplitter(NULL),
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _pFileSwitcherPanel(NULL), _recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _pFileSwitcherPanel(NULL),
_pProjectPanel_1(NULL), _pProjectPanel_2(NULL), _pProjectPanel_3(NULL), _pDocMap(NULL), _pProjectPanel_1(NULL), _pProjectPanel_2(NULL), _pProjectPanel_3(NULL), _pDocMap(NULL),
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _sysMenuEntering(false), _linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _isFolding(false),
_sysMenuEntering(false),
_autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg), _autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg),
_isFileOpening(false), _rememberThisSession(true), _pAnsiCharPanel(NULL), _pClipboardHistoryPanel(NULL) _isFileOpening(false), _rememberThisSession(true), _pAnsiCharPanel(NULL), _pClipboardHistoryPanel(NULL)
{ {
@ -1929,8 +1930,9 @@ void Notepad_plus::addHotSpot(bool docIsModifing)
} }
int startPos = 0; int firstVisibleLine = _pEditView->execute(SCI_GETFIRSTVISIBLELINE);
int endPos = _pEditView->execute(SCI_GETTEXTLENGTH); int startPos = _pEditView->execute(SCI_POSITIONFROMLINE, _pEditView->execute(SCI_DOCLINEFROMVISIBLE, firstVisibleLine));
int endPos = _pEditView->execute(SCI_POSITIONFROMLINE, _pEditView->execute(SCI_DOCLINEFROMVISIBLE, firstVisibleLine + _pEditView->execute(SCI_LINESONSCREEN)));
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX); _pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);

View File

@ -368,6 +368,7 @@ private:
bool _linkTriggered; bool _linkTriggered;
bool _isDocModifing; bool _isDocModifing;
bool _isHotspotDblClicked; bool _isHotspotDblClicked;
bool _isFolding;
//For Dynamic selection highlight //For Dynamic selection highlight
CharacterRange _prevSelectedRange; CharacterRange _prevSelectedRange;

View File

@ -940,7 +940,9 @@ void Notepad_plus::command(int id)
case IDM_VIEW_TOGGLE_FOLDALL: case IDM_VIEW_TOGGLE_FOLDALL:
case IDM_VIEW_TOGGLE_UNFOLDALL: case IDM_VIEW_TOGGLE_UNFOLDALL:
{ {
_isFolding = true; // So we can ignore events while folding is taking place
_pEditView->foldAll((id==IDM_VIEW_TOGGLE_FOLDALL)?fold_collapse:fold_uncollapse); _pEditView->foldAll((id==IDM_VIEW_TOGGLE_FOLDALL)?fold_collapse:fold_uncollapse);
_isFolding = false;
} }
break; break;
@ -952,7 +954,9 @@ void Notepad_plus::command(int id)
case IDM_VIEW_FOLD_6: case IDM_VIEW_FOLD_6:
case IDM_VIEW_FOLD_7: case IDM_VIEW_FOLD_7:
case IDM_VIEW_FOLD_8: case IDM_VIEW_FOLD_8:
_isFolding = true; // So we can ignore events while folding is taking place
_pEditView->collapse(id - IDM_VIEW_FOLD - 1, fold_collapse); _pEditView->collapse(id - IDM_VIEW_FOLD - 1, fold_collapse);
_isFolding = false;
break; break;
case IDM_VIEW_UNFOLD_1: case IDM_VIEW_UNFOLD_1:
@ -963,7 +967,9 @@ void Notepad_plus::command(int id)
case IDM_VIEW_UNFOLD_6: case IDM_VIEW_UNFOLD_6:
case IDM_VIEW_UNFOLD_7: case IDM_VIEW_UNFOLD_7:
case IDM_VIEW_UNFOLD_8: case IDM_VIEW_UNFOLD_8:
_isFolding = true; // So we can ignore events while folding is taking place
_pEditView->collapse(id - IDM_VIEW_UNFOLD - 1, fold_uncollapse); _pEditView->collapse(id - IDM_VIEW_UNFOLD - 1, fold_uncollapse);
_isFolding = false;
break; break;

View File

@ -392,6 +392,14 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|| (notification->nmhdr.hwndFrom == _subEditView.getHSelf())) || (notification->nmhdr.hwndFrom == _subEditView.getHSelf()))
{ {
int lineClicked = notification->line; int lineClicked = notification->line;
if (!_isFolding)
{
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if ((urlAction == 1) || (urlAction == 2))
addHotSpot(_isDocModifing);
}
if (_pDocMap) if (_pDocMap)
_pDocMap->fold(lineClicked, _pEditView->isFolded(lineClicked)); _pDocMap->fold(lineClicked, _pEditView->isFolded(lineClicked));
} }
@ -459,6 +467,10 @@ BOOL Notepad_plus::notify(SCNotification *notification)
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI();
if (nppGUI._enableSmartHilite) if (nppGUI._enableSmartHilite)
_smartHighlighter.highlightView(notifyView); _smartHighlighter.highlightView(notifyView);
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if ((urlAction == 1) || (urlAction == 2))
addHotSpot(_isDocModifing);
break; break;
} }