summaryrefslogtreecommitdiff
path: root/dw/selection.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-09-26 14:24:17 +0200
committerSebastian Geerken <devnull@localhost>2014-09-26 14:24:17 +0200
commit482c58422d36425b3c60ea1a7655b342a5be1228 (patch)
tree11aebabf42875780f8bc09b7c3e44c2f65f9d4b6 /dw/selection.cc
parenta170867c7b7db49e0d52a51f7321b86348fa9ae7 (diff)
RTFL.
Diffstat (limited to 'dw/selection.cc')
-rw-r--r--dw/selection.cc102
1 files changed, 60 insertions, 42 deletions
diff --git a/dw/selection.cc b/dw/selection.cc
index b67f4a6d..a69eb82a 100644
--- a/dw/selection.cc
+++ b/dw/selection.cc
@@ -93,63 +93,79 @@ void SelectionState::resetLink ()
bool SelectionState::buttonPress (Iterator *it, int charPos, int linkNo,
EventButton *event)
{
+ DBG_IF_RTFL {
+ misc::StringBuffer sb;
+ it->intoStringBuffer (&sb);
+ DBG_OBJ_ENTER ("events", 0, "buttonPress", "[%s], %d, %d, ...",
+ sb.getChars (), charPos, linkNo);
+ }
+
Widget *itWidget = it->getWidget ();
bool ret = false;
- if (!event) return ret;
-
- if (event->button == 3) {
- // menu popup
- layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event);
- ret = true;
- } else if (linkNo != -1) {
- // link handling
- (void) layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event);
- resetLink ();
- linkState = LINK_PRESSED;
- linkButton = event->button;
- DeepIterator *newLink = new DeepIterator (it);
- if (newLink->isEmpty ()) {
- delete newLink;
+ if (event) {
+ if (event->button == 3) {
+ // menu popup
+ layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event);
+ ret = true;
+ } else if (linkNo != -1) {
+ // link handling
+ (void) layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event);
resetLink ();
- } else {
- link = newLink;
- // It may be that the user has pressed on something activatable
- // (linkNo != -1), but there is no contents, e.g. with images
- // without ALTernative text.
- if (link) {
- linkChar = correctCharPos (link, charPos);
- linkNumber = linkNo;
+ linkState = LINK_PRESSED;
+ linkButton = event->button;
+ DeepIterator *newLink = new DeepIterator (it);
+ if (newLink->isEmpty ()) {
+ delete newLink;
+ resetLink ();
+ } else {
+ link = newLink;
+ // It may be that the user has pressed on something activatable
+ // (linkNo != -1), but there is no contents, e.g. with images
+ // without ALTernative text.
+ if (link) {
+ linkChar = correctCharPos (link, charPos);
+ linkNumber = linkNo;
+ }
}
- }
- // We do not return the value of the signal method,
- // but we do actually process this event.
- ret = true;
- } else if (event->button == 1) {
- // normal selection handling
- highlight (false, 0);
- resetSelection ();
-
- selectionState = SELECTING;
- DeepIterator *newFrom = new DeepIterator (it);
- if (newFrom->isEmpty ()) {
- delete newFrom;
+ // We do not return the value of the signal method,
+ // but we do actually process this event.
+ ret = true;
+ } else if (event->button == 1) {
+ // normal selection handling
+ highlight (false, 0);
resetSelection ();
- } else {
- from = newFrom;
- fromChar = correctCharPos (from, charPos);
- to = from->cloneDeepIterator ();
- toChar = correctCharPos (to, charPos);
+
+ selectionState = SELECTING;
+ DeepIterator *newFrom = new DeepIterator (it);
+ if (newFrom->isEmpty ()) {
+ delete newFrom;
+ resetSelection ();
+ } else {
+ from = newFrom;
+ fromChar = correctCharPos (from, charPos);
+ to = from->cloneDeepIterator ();
+ toChar = correctCharPos (to, charPos);
+ }
+ ret = true;
}
- ret = true;
}
+ DBG_OBJ_MSGF ("events", 1, "=> %s", ret ? "true" : "false");
+ DBG_OBJ_LEAVE ();
return ret;
}
bool SelectionState::buttonRelease (Iterator *it, int charPos, int linkNo,
EventButton *event)
{
+ DBG_IF_RTFL {
+ misc::StringBuffer sb;
+ it->intoStringBuffer (&sb);
+ DBG_OBJ_ENTER ("events", 0, "buttonRelease", "[%s], %d, %d, ...",
+ sb.getChars (), charPos, linkNo);
+ }
+
Widget *itWidget = it->getWidget ();
bool ret = false;
@@ -186,6 +202,8 @@ bool SelectionState::buttonRelease (Iterator *it, int charPos, int linkNo,
}
}
+ DBG_OBJ_MSGF ("events", 1, "=> %s", ret ? "true" : "false");
+ DBG_OBJ_LEAVE ();
return ret;
}