aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-10-11 21:40:17 +1100
committernyamatongwe <unknown>2010-10-11 21:40:17 +1100
commit66c09167ac82b63f4584ffd28ad425194811595b (patch)
tree7ac755258f485f98c53e4fe7423831d5a24040c1
parent54cd02b4bbe654fea892975d46cd9071a7fc891e (diff)
downloadscintilla-mirror-66c09167ac82b63f4584ffd28ad425194811595b.tar.gz
Feature request #3082409 implemented for SCN_HOTSPOTRELEASECLICK event.
Contributed by Farshid Lashkari.
-rw-r--r--doc/ScintillaDoc.html14
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--src/Editor.cxx22
-rw-r--r--src/Editor.h2
6 files changed, 36 insertions, 5 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 02747ee69..153d0cfda 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -4851,8 +4851,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<code>SciTEBase::Expand()</code> for examples of the use of these messages.</p>
<p><b id="SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</b><br />
- Search efficiently for lines that are contracted fold headers.
- This is useful when saving the user's folding when switching documents or saving folding with a file.
+ Search efficiently for lines that are contracted fold headers.
+ This is useful when saving the user's folding when switching documents or saving folding with a file.
The search starts at line number <code>lineStart</code> and continues forwards to the end of the file.
<code>lineStart</code> is returned if it is a contracted fold header otherwise the next contracted
fold header is returned. If there are no more contracted fold headers then -1 is returned.</p>
@@ -5676,9 +5676,10 @@ struct SCNotification {
int position;
// SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_DWELLSTART,
// SCN_DWELLEND, SCN_CALLTIPCLICK,
- // SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK
+ // SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK
int ch; // SCN_CHARADDED, SCN_KEY
- int modifiers; // SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK
+ int modifiers;
+ // SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
int length; // SCN_MODIFIED
@@ -5718,6 +5719,7 @@ struct SCNotification {
<a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
<a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
<a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
+ <a class="message" href="#SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</a><br />
<a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
<a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
<a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
@@ -6349,12 +6351,14 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
<p>
<b id="SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</b><br />
<b id="SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</b><br />
+ <b id="SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</b><br />
These notifications are generated when the user clicks or double clicks on
text that is in a style with the hotspot attribute set.
This notification can be used to link to variable definitions or web pages.
The <code>position</code> field is set the text position of the click or
double click and the <code>modifiers</code> field set to the key modifiers
- held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
+ held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.
+ Only the state of the Ctrl key is reported for <code>SCN_HOTSPOTRELEASECLICK</code>.</p>
<p>
<b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 1b3ec124e..ae6827309 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -353,6 +353,7 @@
</tr><tr>
<td>Neo</td>
<td>Jordan Russell</td>
+ <td>Farshid Lashkari</td>
</tr>
</table>
<p>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 54f104437..331216979 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -885,6 +885,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_INDICATORRELEASE 2024
#define SCN_AUTOCCANCELLED 2025
#define SCN_AUTOCCHARDELETED 2026
+#define SCN_HOTSPOTRELEASECLICK 2027
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
/* These structures are defined to be exactly the same shape as the Win32
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 679bce53b..a8ef722a0 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -3846,6 +3846,7 @@ evt void IndicatorClick=2023(int modifiers, int position)
evt void IndicatorRelease=2024(int modifiers, int position)
evt void AutoCCancelled=2025(void)
evt void AutoCCharDeleted=2026(void)
+evt void HotSpotReleaseClick=2027(int modifiers, int position)
cat Deprecated
diff --git a/src/Editor.cxx b/src/Editor.cxx
index d180e6194..681cb12cd 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -135,6 +135,7 @@ Editor::Editor() {
dropWentOutside = false;
posDrag = SelectionPosition(invalidPosition);
posDrop = SelectionPosition(invalidPosition);
+ hotSpotClickPos = INVALID_POSITION;
selectionType = selChar;
lastXChosen = 0;
@@ -4198,6 +4199,15 @@ void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt)
NotifyParent(scn);
}
+void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) {
+ SCNotification scn = {0};
+ scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK;
+ scn.position = position;
+ scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
+ (alt ? SCI_ALT : 0);
+ NotifyParent(scn);
+}
+
void Editor::NotifyUpdateUI() {
SCNotification scn = {0};
scn.nmhdr.code = SCN_UPDATEUI;
@@ -5939,6 +5949,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
} else {
if (PointIsHotspot(pt)) {
NotifyHotSpotClicked(newPos.Position(), shift, ctrl, alt);
+ hotSpotClickPos = PositionFromLocation(pt,true,false);
}
if (!shift) {
if (PointInSelection(pt) && !SelectionEmpty())
@@ -6118,6 +6129,13 @@ void Editor::ButtonMove(Point pt) {
if (hsStart != -1 && !PositionIsHotspot(movePos.Position()))
SetHotSpotRange(NULL);
+ if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,false) != hotSpotClickPos ) {
+ if (inDragDrop == ddNone) {
+ DisplayCursor(Window::cursorText);
+ }
+ hotSpotClickPos = INVALID_POSITION;
+ }
+
} else {
if (vs.fixedColumnWidth > 0) { // There is a margin
if (PointInSelMargin(pt)) {
@@ -6148,6 +6166,10 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
inDragDrop = ddNone;
SetEmptySelection(newPos.Position());
}
+ if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) {
+ hotSpotClickPos = INVALID_POSITION;
+ NotifyHotSpotReleaseClick(newPos.Position(), false, ctrl, false);
+ }
if (HaveMouseCapture()) {
if (PointInSelMargin(pt)) {
DisplayCursor(Window::cursorReverseArrow);
diff --git a/src/Editor.h b/src/Editor.h
index 3f36c9088..17683c63a 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -197,6 +197,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool dropWentOutside;
SelectionPosition posDrag;
SelectionPosition posDrop;
+ int hotSpotClickPos;
int lastXChosen;
int lineAnchor;
int originalAnchorPos;
@@ -417,6 +418,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt);
void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt);
+ void NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt);
void NotifyUpdateUI();
void NotifyPainted();
void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt);