changeset 2097:133dedffca47

rm unused double-click code
author corvid <corvid@lavabit.com>
date Thu, 16 Jun 2011 03:30:57 +0000
parents e860e2700446
children 092bbfdbd6d5
files dw/selection.cc dw/selection.hh dw/textblock.cc dw/widget.hh
diffstat 4 files changed, 19 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/dw/selection.cc	Wed Jun 15 13:06:17 2011 -0400
+++ b/dw/selection.cc	Thu Jun 16 03:30:57 2011 +0000
@@ -60,17 +60,6 @@
    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 @@
 }
 
 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::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::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::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:
--- a/dw/selection.hh	Wed Jun 15 13:06:17 2011 -0400
+++ b/dw/selection.hh	Thu Jun 16 03:30:57 2011 +0000
@@ -44,10 +44,6 @@
  *                                          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 @@
 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 @@
 
    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
--- a/dw/textblock.cc	Wed Jun 15 13:06:17 2011 -0400
+++ b/dw/textblock.cc	Thu Jun 16 03:30:57 2011 +0000
@@ -598,10 +598,9 @@
    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 @@
               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 @@
          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 @@
             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 @@
    }
    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;
 }
--- a/dw/widget.hh	Wed Jun 15 13:06:17 2011 -0400
+++ b/dw/widget.hh	Thu Jun 16 03:30:57 2011 +0000
@@ -203,25 +203,21 @@
 
    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;