aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/selection.cc41
-rw-r--r--dw/selection.hh40
-rw-r--r--dw/textblock.cc11
-rw-r--r--dw/widget.hh14
4 files changed, 19 insertions, 87 deletions
diff --git a/dw/selection.cc b/dw/selection.cc
index 6f48140f..9702eee0 100644
--- a/dw/selection.cc
+++ b/dw/selection.cc
@@ -60,17 +60,6 @@ SelectionState::~SelectionState ()
reset ();
}
-
-bool SelectionState::DoubleClickEmitter::emitToReceiver (lout::signal::Receiver
- *receiver,
- int signalNo,
- int argc,
- Object **argv)
-{
- ((DoubleClickReceiver*)receiver)->doubleClick ();
- return false;
-}
-
void SelectionState::reset ()
{
resetSelection ();
@@ -98,24 +87,14 @@ void SelectionState::resetLink ()
}
bool SelectionState::buttonPress (Iterator *it, int charPos, int linkNo,
- EventButton *event, bool withinContent)
+ EventButton *event)
{
Widget *itWidget = it->getWidget ();
bool ret = false;
if (!event) return ret;
- if (event->button == 1 && !withinContent && event->numPressed == 2) {
- // When the user double-clicks on empty parts, emit the double click
- // signal instead of normal processing. Used for full screen
- // mode.
- doubleClickEmitter.emitDoubleClick ();
- // Reset everything, so that dw::core::Selection::buttonRelease will
- // ignore the "release" event following soon.
- highlight (false, 0);
- reset ();
- ret = true;
- } else if (linkNo != -1) {
+ if (linkNo != -1) {
// link handling
(void) layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event);
resetLink ();
@@ -165,7 +144,7 @@ bool SelectionState::buttonPress (Iterator *it, int charPos, int linkNo,
}
bool SelectionState::buttonRelease (Iterator *it, int charPos, int linkNo,
- EventButton *event, bool withinContent)
+ EventButton *event)
{
Widget *itWidget = it->getWidget ();
bool ret = false;
@@ -207,7 +186,7 @@ bool SelectionState::buttonRelease (Iterator *it, int charPos, int linkNo,
}
bool SelectionState::buttonMotion (Iterator *it, int charPos, int linkNo,
- EventMotion *event, bool withinContent)
+ EventMotion *event)
{
if (linkState == LINK_PRESSED) {
//link handling
@@ -231,21 +210,17 @@ bool SelectionState::buttonMotion (Iterator *it, int charPos, int linkNo,
*/
bool SelectionState::handleEvent (EventType eventType, Iterator *it,
int charPos, int linkNo,
- MousePositionEvent *event,
- bool withinContent)
+ MousePositionEvent *event)
{
switch (eventType) {
case BUTTON_PRESS:
- return buttonPress (it, charPos, linkNo, (EventButton*)event,
- withinContent);
+ return buttonPress (it, charPos, linkNo, (EventButton*)event);
case BUTTON_RELEASE:
- return buttonRelease (it, charPos, linkNo, (EventButton*)event,
- withinContent);
+ return buttonRelease (it, charPos, linkNo, (EventButton*)event);
case BUTTON_MOTION:
- return buttonMotion (it, charPos, linkNo, (EventMotion*)event,
- withinContent);
+ return buttonMotion (it, charPos, linkNo, (EventMotion*)event);
default:
diff --git a/dw/selection.hh b/dw/selection.hh
index ba03fd18..7f6b1a58 100644
--- a/dw/selection.hh
+++ b/dw/selection.hh
@@ -44,10 +44,6 @@ namespace core {
* otherwise -1
* <tr><td>dw::core::EventButton *event <td>the event itself; only the button
* is used
- * <tr><td>bool withinContent <td>true, if there is some selectable
- * content unter the mouse cursor; if
- * set to false, the "full screen"
- * feature is used on double click.
* </table>
*
* Look also at dw::core::SelectionState::handleEvent, which may be useful
@@ -184,31 +180,7 @@ class SelectionState
public:
enum { END_OF_WORD = 1 << 30 };
- class DoubleClickReceiver: public lout::signal::Receiver
- {
- public:
- virtual void doubleClick () = 0;
- };
-
private:
- class DoubleClickEmitter: public lout::signal::Emitter
- {
- private:
- enum { DOUBLE_CLICK };
-
- protected:
- bool emitToReceiver (lout::signal::Receiver *receiver, int signalNo,
- int argc, Object **argv);
-
- public:
- inline void connectDoubleClick (DoubleClickReceiver *receiver)
- { connect (receiver); }
-
- inline void emitDoubleClick () { emitVoid (DOUBLE_CLICK, 0, NULL); }
- };
-
- DoubleClickEmitter doubleClickEmitter;
-
Layout *layout;
// selection
@@ -252,19 +224,15 @@ public:
inline void setLayout (Layout *layout) { this->layout = layout; }
void reset ();
- inline void connectDoubleClick (DoubleClickReceiver *receiver)
- { doubleClickEmitter.connectDoubleClick (receiver); }
-
bool buttonPress (Iterator *it, int charPos, int linkNo,
- EventButton *event, bool withinContent);
+ EventButton *event);
bool buttonRelease (Iterator *it, int charPos, int linkNo,
- EventButton *event, bool withinContent);
+ EventButton *event);
bool buttonMotion (Iterator *it, int charPos, int linkNo,
- EventMotion *event, bool withinContent);
+ EventMotion *event);
bool handleEvent (EventType eventType, Iterator *it, int charPos,
- int linkNo, MousePositionEvent *event,
- bool withinContent);
+ int linkNo, MousePositionEvent *event);
};
} // namespace dw
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 401ada66..045ab729 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -598,10 +598,9 @@ bool Textblock::sendSelectionEvent (core::SelectionState::EventType eventType,
int nextWordStartX, wordStartX, wordX, nextWordX, yFirst, yLast;
int charPos = 0, link = -1, prevPos, wordIndex, lineIndex;
Word *word;
- bool found, r, withinContent = true;
+ bool found, r;
if (words->size () == 0) {
- withinContent = false;
wordIndex = -1;
} else {
lastLine = lines->getRef (lines->size () - 1);
@@ -610,12 +609,10 @@ bool Textblock::sendSelectionEvent (core::SelectionState::EventType eventType,
lastLine->boxDescent;
if (event->yCanvas < yFirst) {
// Above the first line: take the first word.
- withinContent = false;
wordIndex = 0;
charPos = 0;
} else if (event->yCanvas >= yLast) {
// Below the last line: take the last word.
- withinContent = false;
wordIndex = words->size () - 1;
word = words->getRef (wordIndex);
charPos = word->content.type == core::Content::TEXT ?
@@ -628,13 +625,11 @@ bool Textblock::sendSelectionEvent (core::SelectionState::EventType eventType,
if (event->yWidget >
(lineYOffsetWidget (line) + line->boxAscent + line->boxDescent)) {
// Choose this break.
- withinContent = false;
wordIndex = line->lastWord;
charPos = 0;
} else if (event->xWidget < lineXOffsetWidget (line)) {
// Left of the first word in the line.
wordIndex = line->firstWord;
- withinContent = false;
charPos = 0;
} else {
nextWordStartX = lineXOffsetWidget (line);
@@ -688,7 +683,6 @@ bool Textblock::sendSelectionEvent (core::SelectionState::EventType eventType,
if (!found) {
// No word found in this line (i.e. we are on the right side),
// take the last of this line.
- withinContent = false;
wordIndex = line->lastWord;
if (wordIndex >= words->size ())
wordIndex--;
@@ -702,8 +696,7 @@ bool Textblock::sendSelectionEvent (core::SelectionState::EventType eventType,
}
it = new TextblockIterator (this, core::Content::SELECTION_CONTENT,
wordIndex);
- r = selectionHandleEvent (eventType, it, charPos, link, event,
- withinContent);
+ r = selectionHandleEvent (eventType, it, charPos, link, event);
it->unref ();
return r;
}
diff --git a/dw/widget.hh b/dw/widget.hh
index 727aff05..b751a282 100644
--- a/dw/widget.hh
+++ b/dw/widget.hh
@@ -203,25 +203,21 @@ protected:
inline bool selectionButtonPress (Iterator *it, int charPos, int linkNo,
EventButton *event, bool withinContent)
- { return layout->selectionState.buttonPress (it, charPos, linkNo, event,
- withinContent); }
+ { return layout->selectionState.buttonPress (it, charPos, linkNo, event); }
inline bool selectionButtonRelease (Iterator *it, int charPos, int linkNo,
EventButton *event, bool withinContent)
- { return layout->selectionState.buttonRelease (it, charPos, linkNo, event,
- withinContent); }
+ { return layout->selectionState.buttonRelease (it, charPos, linkNo, event);}
inline bool selectionButtonMotion (Iterator *it, int charPos, int linkNo,
EventMotion *event, bool withinContent)
- { return layout->selectionState.buttonMotion (it, charPos, linkNo, event,
- withinContent); }
+ { return layout->selectionState.buttonMotion (it, charPos, linkNo, event); }
inline bool selectionHandleEvent (SelectionState::EventType eventType,
Iterator *it, int charPos, int linkNo,
- MousePositionEvent *event,
- bool withinContent)
+ MousePositionEvent *event)
{ return layout->selectionState.handleEvent (eventType, it, charPos, linkNo,
- event, withinContent); }
+ event); }
private:
void *deleteCallbackData;