[REVERT] Revert to old clickable link implementation which is more accurate.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@300 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-07-21 20:49:03 +00:00
parent d156d90a9e
commit ccef65d20d
10 changed files with 167 additions and 361 deletions

View File

@ -42,6 +42,7 @@
#include "xmlMatchedTagsHighlighter.h"
const char Notepad_plus::_className[32] = NOTEPAD_PP_CLASS_NAME;
const char *urlHttpRegExpr = "http://[a-z0-9_\\-\\+.:?&@=/%#]*";
int docTabIconIDs[] = {IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON};
enum tb_stat {tb_saved, tb_unsaved, tb_ro};
@ -71,8 +72,8 @@ struct SortTaskListPred
Notepad_plus::Notepad_plus(): Window(), _mainWindowStatus(0), _pDocTab(NULL), _pEditView(NULL),
_pMainSplitter(NULL), _isfullScreen(false),
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _isRTL(false),
_isHotspotDblClicked(false), _isLinkTriggered(false), _sysMenuEntering(false), _smartHighlighter(&_findReplaceDlg),
_urlHighlighter(&_findReplaceDlg), _autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView)
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _sysMenuEntering(false),
_autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg)
{
ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange));
@ -684,6 +685,8 @@ BufferID Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
}
}
PathRemoveFileSpec(longFileName);
_linkTriggered = true;
_isDocModifing = false;
// Notify plugins that current file is just opened
scnN.nmhdr.code = NPPN_FILEOPENED;
@ -1800,22 +1803,20 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT))
{
prevWasEdit = true;
_isLinkTriggered = true;
_linkTriggered = true;
_isDocModifing = true;
::InvalidateRect(notifyView->getHSelf(), NULL, TRUE);
}
if (notification->modificationType & (SC_MOD_CHANGESTYLE))
{
_isLinkTriggered = true;
}
if (notification->modificationType & SC_MOD_CHANGEFOLD)
{
if (prevWasEdit)
{
notifyView->foldChanged(notification->line, notification->foldLevelNow, notification->foldLevelPrev);
if (prevWasEdit) {
notifyView->foldChanged(notification->line,
notification->foldLevelNow, notification->foldLevelPrev);
prevWasEdit = false;
}
}
else if (!(notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)))
else
if (!(notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)))
{
prevWasEdit = false;
}
@ -2205,10 +2206,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_DOUBLECLICK :
{
int pos = notifyView->execute(SCI_GETCURRENTPOS);
int idStyle = notifyView->execute(SCI_GETSTYLEAT, pos);
bool isHotspot = notifyView->execute(SCI_STYLEGETHOTSPOT, idStyle) != 0;
if (isHotspot)
if (_isHotspotDblClicked)
{
int pos = notifyView->execute(SCI_GETCURRENTPOS);
notifyView->execute(SCI_SETCURRENTPOS, pos);
@ -2229,7 +2227,6 @@ BOOL Notepad_plus::notify(SCNotification *notification)
xmlTagMatchHiliter.tagMatch(nppGUI._enableTagAttrsHilite);
}
_smartHighlighter.highlightView(notifyView);
updateStatusBar();
AutoCompletion * autoC = isFromPrimary?&_autoCompleteMain:&_autoCompleteSub;
autoC->update(0);
@ -2238,11 +2235,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_SCROLLED:
{
if (notification->wParam) //scrolling vertically
{
_smartHighlighter.highlightView(notifyView);
_urlHighlighter.highlightView(notifyView);
}
_smartHighlighter.highlightView(notifyView);
break;
}
@ -2294,13 +2287,17 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_PAINTED:
{
if (_isLinkTriggered)
{
_urlHighlighter.highlightView(notifyView);
_isLinkTriggered = false;
}
if (_syncInfo.doSync())
doSynScorll(HWND(notification->nmhdr.hwndFrom));
if (_linkTriggered)
{
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if ((urlAction == 1) || (urlAction == 2))
addHotSpot(_isDocModifing);
_linkTriggered = false;
_isDocModifing = false;
}
break;
}
@ -2315,22 +2312,19 @@ BOOL Notepad_plus::notify(SCNotification *notification)
notifyView->execute(SCI_SETTARGETSTART, startPos);
notifyView->execute(SCI_SETTARGETEND, endPos);
/*int posFound = notifyView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr);
int posFound = notifyView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr);
if (posFound != -1)
{
startPos = int(notifyView->execute(SCI_GETTARGETSTART));
endPos = int(notifyView->execute(SCI_GETTARGETEND));
}*/
}
int length = endPos-startPos+1;
char * currentWord = new char[length];
char currentWord[MAX_PATH*2];
notifyView->getText(currentWord, startPos, endPos);
::ShellExecute(_hSelf, "open", currentWord, NULL, NULL, SW_SHOW);
//Disabled: This message comes after SCN_DOUBLECLICK, so this method fails and prevents the next doubleclick from working
//_isHotspotDblClicked = true;
_isHotspotDblClicked = true;
notifyView->execute(SCI_SETCHARSDEFAULT);
delete [] currentWord;
break;
}
@ -2457,6 +2451,133 @@ void Notepad_plus::charAdded(char chAdded)
MaintainIndentation(chAdded);
}
void Notepad_plus::addHotSpot(bool docIsModifing)
{
//bool docIsModifing = true;
int posBegin2style = 0;
if (docIsModifing)
posBegin2style = _pEditView->execute(SCI_GETCURRENTPOS);
int endStyle = _pEditView->execute(SCI_GETENDSTYLED);
if (docIsModifing)
{
posBegin2style = _pEditView->execute(SCI_GETCURRENTPOS);
if (posBegin2style > 0) posBegin2style--;
unsigned char ch = (unsigned char)_pEditView->execute(SCI_GETCHARAT, posBegin2style);
// determinating the type of EOF to make sure how many steps should we be back
if ((ch == 0x0A) || (ch == 0x0D))
{
int eolMode = _pEditView->execute(SCI_GETEOLMODE);
if ((eolMode == SC_EOL_CRLF) && (posBegin2style > 1))
posBegin2style -= 2;
else if (posBegin2style > 0)
posBegin2style -= 1;
}
ch = (unsigned char)_pEditView->execute(SCI_GETCHARAT, posBegin2style);
while ((posBegin2style > 0) && ((ch != 0x0A) && (ch != 0x0D)))
{
ch = (unsigned char)_pEditView->execute(SCI_GETCHARAT, posBegin2style--);
}
}
int style_hotspot = 30;
int startPos = 0;
int endPos = _pEditView->execute(SCI_GETTEXTLENGTH);
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
_pEditView->execute(SCI_SETTARGETSTART, startPos);
_pEditView->execute(SCI_SETTARGETEND, endPos);
vector<pair<int, int> > hotspotStylers;
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr);
while (posFound != -1)
{
int start = int(_pEditView->execute(SCI_GETTARGETSTART));
int end = int(_pEditView->execute(SCI_GETTARGETEND));
int foundTextLen = end - start;
int idStyle = _pEditView->execute(SCI_GETSTYLEAT, posFound);
if (end < posBegin2style - 1)
{
if (style_hotspot > 1)
style_hotspot--;
}
else
{
int fs = -1;
for (size_t i = 0 ; i < hotspotStylers.size() ; i++)
{
if (hotspotStylers[i].second == idStyle)
{
fs = hotspotStylers[i].first;
break;
}
}
if (fs != -1)
{
_pEditView->execute(SCI_STARTSTYLING, start, 0xFF);
_pEditView->execute(SCI_SETSTYLING, foundTextLen, fs);
}
else
{
pair<int, int> p(style_hotspot, idStyle);
hotspotStylers.push_back(p);
int activeFG = 0xFF0000;
char fontName[256];
Style hotspotStyle;
hotspotStyle._styleID = style_hotspot;
_pEditView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)fontName);
hotspotStyle._fgColor = _pEditView->execute(SCI_STYLEGETFORE, idStyle);
hotspotStyle._bgColor = _pEditView->execute(SCI_STYLEGETBACK, idStyle);
hotspotStyle._fontSize = _pEditView->execute(SCI_STYLEGETSIZE, idStyle);
int isBold = _pEditView->execute(SCI_STYLEGETBOLD, idStyle);
int isItalic = _pEditView->execute(SCI_STYLEGETITALIC, idStyle);
int isUnderline = _pEditView->execute(SCI_STYLEGETUNDERLINE, idStyle);
hotspotStyle._fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0);
int fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0);
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if (urlAction == 2)
hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE;
_pEditView->setStyle(hotspotStyle);
_pEditView->execute(SCI_STYLESETHOTSPOT, style_hotspot, TRUE);
_pEditView->execute(SCI_SETHOTSPOTACTIVEFORE, TRUE, activeFG);
_pEditView->execute(SCI_SETHOTSPOTSINGLELINE, style_hotspot, 0);
_pEditView->execute(SCI_STARTSTYLING, start, 0x1F);
_pEditView->execute(SCI_SETSTYLING, foundTextLen, style_hotspot);
if (style_hotspot > 1)
style_hotspot--;
}
}
_pEditView->execute(SCI_SETTARGETSTART, posFound + foundTextLen);
_pEditView->execute(SCI_SETTARGETEND, endPos);
posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr);
}
_pEditView->execute(SCI_STARTSTYLING, endStyle, 0xFF);
_pEditView->execute(SCI_SETSTYLING, 0, 0);
}
void Notepad_plus::MaintainIndentation(char ch)
{
int eolMode = int(_pEditView->execute(SCI_GETEOLMODE));
@ -3866,6 +3987,7 @@ void Notepad_plus::command(int id)
tld.doDialog();
}
}
_linkTriggered = true;
}
break;
@ -6533,6 +6655,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
nbDoc += viewVisible(SUB_VIEW)?_subDocTab.nbItem():0;
if (nbDoc > 1)
activateNextDoc((GET_APPCOMMAND_LPARAM(lParam) == APPCOMMAND_BROWSER_FORWARD)?dirDown:dirUp);
_linkTriggered = true;
}
return ::DefWindowProc(hwnd, Message, wParam, lParam);
}
@ -8081,9 +8204,10 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) {
setWorkingDir(dir);
setTitle();
//Make sure the colors of the tab controls match
_isLinkTriggered = true;
::InvalidateRect(_mainDocTab.getHSelf(), NULL, FALSE);
::InvalidateRect(_subDocTab.getHSelf(), NULL, FALSE);
_linkTriggered = true;
}
void Notepad_plus::loadCommandlineParams(const char * commandLine, CmdLineParams * pCmdParams) {

View File

@ -49,7 +49,6 @@
#include "AutoCompletion.h"
#include "Buffer.h"
#include "SmartHighlighter.h"
#include "UrlHighlighter.h"
#define NOTEPAD_PP_CLASS_NAME "Notepad++"
@ -200,7 +199,6 @@ private:
AutoCompletion _autoCompleteSub; //each Scintilla has its own autoComplete
SmartHighlighter _smartHighlighter;
UrlHighlighter _urlHighlighter;
TiXmlNode *_nativeLang, *_toolIcons;
@ -265,8 +263,9 @@ private:
RunMacroDlg _runMacroDlg;
// For hotspot
bool _linkTriggered;
bool _isDocModifing;
bool _isHotspotDblClicked;
bool _isLinkTriggered;
//For Dynamic selection highlight
CharacterRange _prevSelectedRange;
@ -527,6 +526,8 @@ private:
void charAdded(char chAdded);
void MaintainIndentation(char ch);
void addHotSpot(bool docIsModifing = false);
void bookmarkAdd(int lineno) const {
if (lineno == -1)
lineno = _pEditView->getCurrentLineNumber();

View File

@ -187,11 +187,6 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGMATCH, true);
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGATTR, true);
// URL highlighting
int activeFG = 0xFF0000;
execute(SCI_SETHOTSPOTACTIVEFORE, TRUE, activeFG);
execute(SCI_SETHOTSPOTSINGLELINE, FALSE);
_pParameter = NppParameters::getInstance();
_codepage = ::GetACP();

View File

@ -35,9 +35,6 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
//Get selection
CharacterRange range = pHighlightView->getSelection();
//if (pHighlightView->isSelecting())
// return;
//Clear marks
pHighlightView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_2);

View File

@ -1,269 +0,0 @@
//this file is part of notepad++
//Copyright (C)2003 Harry <harrybharry@users.sourceforge.net>
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "UrlHighlighter.h"
#include "Parameters.h"
#define MAXLINEHIGHLIGHT 400 //prevent highlighter from doing too much work when a lot is visible
const char *urlHttpRegExpr = "http://[a-z0-9_\\-\\+.:?&@=/%#]*";
const char *urlHttpsRegExpr ="https://[a-z0-9_\\-\\+.:?&@=/%#]*";
const char *urlFtpRegExpr = "ftp://[a-z0-9_\\-\\+.:?&@=/%#]*";
const char *emailRegExpr = "mailto:[a-z0-9._-]+@[a-z0-9.-]+\\.[a-z]+";
//Used to map style to style with hotspot properties
struct HotspotStyle {
int styleID;
int hotspotID;
HotspotStyle(int sid, int hid) : styleID(sid), hotspotID(hid) {};
};
UrlHighlighter::UrlHighlighter(FindReplaceDlg * pFRDlg)
: _pFRDlg(pFRDlg), _isDrawing(false)
{
//Nothing to do
}
void UrlHighlighter::highlightView(ScintillaEditView * pHighlightView)
{
if (_isDrawing)
return;
_isDrawing = true;
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI();
//Test if highlight is needed
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if ((urlAction != 1) && (urlAction != 2))
return;
// Save target locations for other search functions
int loc = (int)pHighlightView->execute(SCI_GETENDSTYLED);
int originalStartPos = (int)pHighlightView->execute(SCI_GETTARGETSTART);
int originalEndPos = (int)pHighlightView->execute(SCI_GETTARGETEND);
// Get the range of text visible and highlight everything in it
int firstLine = (int)pHighlightView->execute(SCI_GETFIRSTVISIBLELINE);
int nrLines = min((int)pHighlightView->execute(SCI_LINESONSCREEN), MAXLINEHIGHLIGHT ) + 1;
int lastLine = (int)pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, firstLine + nrLines);
const int startPos =(int)pHighlightView->execute(SCI_POSITIONFROMLINE, firstLine);
int endPos = (int)pHighlightView->execute(SCI_POSITIONFROMLINE, lastLine);
if (endPos == -1) //past EOF
endPos = (int)pHighlightView->getCurrentDocLen() - 1;
int preEndStyled = (int)pHighlightView->execute(SCI_GETENDSTYLED);
int nextHotspotStyle = 31; //First style to be used for hotspot
vector< HotspotStyle > hotspotStylers; //current stylers that map normal style to style with hotspot
pHighlightView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
vector<const char *> urlRegExpressions;
urlRegExpressions.push_back(urlHttpRegExpr);
urlRegExpressions.push_back(urlHttpsRegExpr);
urlRegExpressions.push_back(urlFtpRegExpr);
urlRegExpressions.push_back(emailRegExpr);
int hotSpotStyle = 31;
pHighlightView->execute(SCI_STYLESETFORE, hotSpotStyle, blue);
pHighlightView->execute(SCI_STYLESETUNDERLINE, hotSpotStyle, TRUE);
pHighlightView->execute(SCI_STYLESETHOTSPOT, hotSpotStyle, TRUE);
for (size_t k = 0 ; k < urlRegExpressions.size() ; k++)
{
pHighlightView->execute(SCI_SETTARGETSTART, startPos);
pHighlightView->execute(SCI_SETTARGETEND, endPos);
int targetStart = 0;
int targetEnd = 0;
targetStart = pHighlightView->execute(SCI_SEARCHINTARGET, strlen(urlRegExpressions[k]), (LPARAM)urlRegExpressions[k]);
while (targetStart != -1)
{
targetStart = (int)(pHighlightView->execute(SCI_GETTARGETSTART));
targetEnd = (int)(pHighlightView->execute(SCI_GETTARGETEND));
int foundTextLen = targetEnd - targetStart;
int idStyle = pHighlightView->execute(SCI_GETSTYLEAT, targetStart);
pHighlightView->execute(SCI_STARTSTYLING, targetStart, 0xFF);
pHighlightView->execute(SCI_SETSTYLING, foundTextLen, hotSpotStyle);
int startMovingPos = targetStart + foundTextLen;
if (startMovingPos >= endPos)
{
targetStart = -1;
}
else
{
pHighlightView->execute(SCI_SETTARGETSTART, startMovingPos);
pHighlightView->execute(SCI_SETTARGETEND, endPos);
targetStart = pHighlightView->execute(SCI_SEARCHINTARGET, strlen(urlRegExpressions[k]), (LPARAM)urlRegExpressions[k]);
}
}
}
pHighlightView->execute(SCI_STARTSTYLING, preEndStyled, 0xFF);
// restore the original targets to avoid conflicts with the search/replace functions
pHighlightView->execute(SCI_SETTARGETSTART, originalStartPos);
pHighlightView->execute(SCI_SETTARGETEND, originalEndPos);
_isDrawing = false;
}
/*
void UrlHighlighter::highlightView(ScintillaEditView * pHighlightView)
{
if (_isDrawing)
return;
_isDrawing = true;
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI();
//Test if highlight is needed
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if ((urlAction != 1) && (urlAction != 2))
return;
// Save target locations for other search functions
int loc = (int)pHighlightView->execute(SCI_GETENDSTYLED);
int originalStartPos = (int)pHighlightView->execute(SCI_GETTARGETSTART);
int originalEndPos = (int)pHighlightView->execute(SCI_GETTARGETEND);
// Get the range of text visible and highlight everything in it
int firstLine = (int)pHighlightView->execute(SCI_GETFIRSTVISIBLELINE);
int nrLines = min((int)pHighlightView->execute(SCI_LINESONSCREEN), MAXLINEHIGHLIGHT ) + 1;
int lastLine = (int)pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, firstLine + nrLines);
const int startPos =(int)pHighlightView->execute(SCI_POSITIONFROMLINE, firstLine);
int endPos = (int)pHighlightView->execute(SCI_POSITIONFROMLINE, lastLine);
if (endPos == -1) //past EOF
endPos = (int)pHighlightView->getCurrentDocLen() - 1;
int preEndStyled = (int)pHighlightView->execute(SCI_GETENDSTYLED);
int nextHotspotStyle = 31; //First style to be used for hotspot
vector< HotspotStyle > hotspotStylers; //current stylers that map normal style to style with hotspot
pHighlightView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
vector<const char *> urlRegExpressions;
urlRegExpressions.push_back(urlHttpRegExpr);
urlRegExpressions.push_back(urlHttpsRegExpr);
urlRegExpressions.push_back(urlFtpRegExpr);
urlRegExpressions.push_back(emailRegExpr);
for (size_t k = 0 ; k < urlRegExpressions.size() ; k++)
{
pHighlightView->execute(SCI_SETTARGETSTART, startPos);
pHighlightView->execute(SCI_SETTARGETEND, endPos);
int targetStart = 0;
int targetEnd = 0;
targetStart = pHighlightView->execute(SCI_SEARCHINTARGET, strlen(urlRegExpressions[k]), (LPARAM)urlRegExpressions[k]);
while (targetStart != -1)
{
targetStart = (int)(pHighlightView->execute(SCI_GETTARGETSTART));
targetEnd = (int)(pHighlightView->execute(SCI_GETTARGETEND));
int foundTextLen = targetEnd - targetStart;
int idStyle = pHighlightView->execute(SCI_GETSTYLEAT, targetStart);
int foundStyle = -1;
for (size_t i = 0 ; i < hotspotStylers.size() ; i++)
{
if (hotspotStylers[i].styleID == idStyle)
{
foundStyle = hotspotStylers[i].hotspotID;
break;
}
if (hotspotStylers[i].hotspotID == idStyle)
{
foundStyle = hotspotStylers[i].hotspotID;
break;
}
}
if (foundStyle == -1) //no hotspot style for this style, create one
{
if (nextHotspotStyle == 0)
{
//no style slots left
}
else
{
hotspotStylers.push_back(HotspotStyle(idStyle, nextHotspotStyle));
char fontName[256];
Style hotspotStyle;
hotspotStyle._styleID = nextHotspotStyle;
pHighlightView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)fontName);
hotspotStyle._fontName = &fontName[0];
hotspotStyle._fgColor = pHighlightView->execute(SCI_STYLEGETFORE, idStyle);
hotspotStyle._bgColor = pHighlightView->execute(SCI_STYLEGETBACK, idStyle);
hotspotStyle._fontSize = pHighlightView->execute(SCI_STYLEGETSIZE, idStyle);
int isBold = pHighlightView->execute(SCI_STYLEGETBOLD, idStyle);
int isItalic = pHighlightView->execute(SCI_STYLEGETITALIC, idStyle);
int isUnderline = pHighlightView->execute(SCI_STYLEGETUNDERLINE, idStyle);
hotspotStyle._fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0);
if (urlAction == 2)
hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE; //force underline
//Apply style
pHighlightView->execute(SCI_STYLESETFORE, nextHotspotStyle, hotspotStyle._fgColor);
pHighlightView->execute(SCI_STYLESETBACK, nextHotspotStyle, hotspotStyle._bgColor);
pHighlightView->execute(SCI_STYLESETFONT, nextHotspotStyle, (LPARAM)hotspotStyle._fontName);
pHighlightView->execute(SCI_STYLESETBOLD, nextHotspotStyle, hotspotStyle._fontStyle & FONTSTYLE_BOLD);
pHighlightView->execute(SCI_STYLESETITALIC, nextHotspotStyle, hotspotStyle._fontStyle & FONTSTYLE_ITALIC);
pHighlightView->execute(SCI_STYLESETUNDERLINE, nextHotspotStyle, hotspotStyle._fontStyle & FONTSTYLE_UNDERLINE);
pHighlightView->execute(SCI_STYLESETSIZE, nextHotspotStyle, hotspotStyle._fontSize);
pHighlightView->execute(SCI_STYLESETHOTSPOT, nextHotspotStyle, TRUE);
foundStyle = nextHotspotStyle;
nextHotspotStyle--;
}
}
else //if a style could be found, apply it
{
pHighlightView->execute(SCI_STARTSTYLING, targetStart, 0xFF);
pHighlightView->execute(SCI_SETSTYLING, foundTextLen, foundStyle);
}
int startMovingPos = targetStart + foundTextLen;
if (startMovingPos >= endPos)
{
targetStart = -1;
}
else
{
pHighlightView->execute(SCI_SETTARGETSTART, startMovingPos);
pHighlightView->execute(SCI_SETTARGETEND, endPos);
targetStart = pHighlightView->execute(SCI_SEARCHINTARGET, strlen(urlRegExpressions[k]), (LPARAM)urlRegExpressions[k]);
}
}
}
pHighlightView->execute(SCI_STARTSTYLING, preEndStyled, 0xFF);
// restore the original targets to avoid conflicts with the search/replace functions
pHighlightView->execute(SCI_SETTARGETSTART, originalStartPos);
pHighlightView->execute(SCI_SETTARGETEND, originalEndPos);
_isDrawing = false;
}
*/

View File

@ -1,33 +0,0 @@
//this file is part of notepad++
//Copyright (C)2003 Harry <harrybharry@users.sourceforge.net>
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef URLHIGHLIGHTER_H
#define URLHIGHLIGHTER_H
#include "ScintillaEditView.h"
#include "FindReplaceDlg.h"
class UrlHighlighter {
public:
UrlHighlighter(FindReplaceDlg * pFRDlg);
void highlightView(ScintillaEditView * pHighlightView);
private:
FindReplaceDlg * _pFRDlg;
bool _isDrawing;
};
#endif //URLHIGHLIGHTER_H

View File

@ -75,7 +75,7 @@
<Keywords name="instre1">as case class data default deriving do else hiding if import in infix infixl infixr instance let module newtype of proc qualified rec then type where _</Keywords>
</Language>
<Language name="html" ext="html htm shtml shtm xhtml" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;">
<Keywords name="instre1">!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan comment compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em embed enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noembed noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns</Keywords>
<Keywords name="instre1">!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns</Keywords>
</Language>
<Language name="ini" ext="ini inf reg url" commentLine=";">
</Language>

View File

@ -409,10 +409,6 @@
RelativePath="..\src\WinControls\AboutDlg\URLCtrl.cpp"
>
</File>
<File
RelativePath="..\src\ScitillaComponent\UrlHighlighter.cpp"
>
</File>
<File
RelativePath="..\src\ScitillaComponent\UserDefineDialog.cpp"
>
@ -722,10 +718,6 @@
RelativePath="..\src\WinControls\AboutDlg\URLCtrl.h"
>
</File>
<File
RelativePath="..\src\ScitillaComponent\UrlHighlighter.h"
>
</File>
<File
RelativePath="..\src\ScitillaComponent\UserDefineDialog.h"
>

View File

@ -898,7 +898,7 @@ void Editor::ScrollTo(int line, bool moveThumb) {
if (moveThumb) {
SetVerticalScrollPos();
}
NotifyScrolled(true);
NotifyScrolled();
}
}
@ -917,7 +917,7 @@ void Editor::HorizontalScrollTo(int xPos) {
RedrawRect(GetClientRectangle());
}
NotifyScrolled(false);
NotifyScrolled();
}
void Editor::MoveCaretInsideView(bool ensureVisible) {
@ -3717,10 +3717,9 @@ void Editor::NotifyPainted() {
NotifyParent(scn);
}
void Editor::NotifyScrolled(bool vertical) {
void Editor::NotifyScrolled() {
SCNotification scn = {0};
scn.nmhdr.code = SCN_SCROLLED;
scn.wParam = vertical; //true if vertical scrolling
NotifyParent(scn);
}

View File

@ -370,7 +370,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt);
void NotifyUpdateUI();
void NotifyPainted();
void NotifyScrolled(bool vertical);
void NotifyScrolled();
void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt);
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyNeedShown(int pos, int len);