chat: custom message selection

Allow user to drag-select multiple messages

Change-Id: I1fcf115822dab791d3df35b29696be3af3800204
Tuleap: #202
diff --git a/src/ConversationVC.mm b/src/ConversationVC.mm
index 142da89..24ae5d9 100644
--- a/src/ConversationVC.mm
+++ b/src/ConversationVC.mm
@@ -37,6 +37,7 @@
 #import "views/IMTableCellView.h"
 #import "views/NSColor+RingTheme.h"
 #import "QNSTreeController.h"
+#import "INDSequentialTextSelectionManager.h"
 #import "delegates/ImageManipulationDelegate.h"
 
 #import <QuartzCore/QuartzCore.h>
@@ -58,6 +59,8 @@
     __unsafe_unretained IBOutlet NSPopUpButton* contactMethodsPopupButton;
 }
 
+@property (nonatomic, strong, readonly) INDSequentialTextSelectionManager* selectionManager;
+
 @end
 
 @implementation ConversationVC
@@ -72,6 +75,7 @@
 
     [sendPanel setWantsLayer:YES];
     [sendPanel setLayer:[CALayer layer]];
+    _selectionManager = [[INDSequentialTextSelectionManager alloc] init];
 
     [self setupChat];
 
@@ -95,6 +99,8 @@
                              return ;
                          }
 
+                         [self.selectionManager unregisterAllTextViews];
+
                          [contactMethodsPopupButton removeAllItems];
                          for (auto cm : contactMethods) {
                              [contactMethodsPopupButton addItemWithTitle:cm->uri().toNSString()];
@@ -231,6 +237,10 @@
 
 - (void)outlineView:(NSOutlineView *)outlineView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row
 {
+    if (IMTableCellView* cellView = [outlineView viewAtColumn:0 row:row makeIfNecessary:NO]) {
+        [self.selectionManager registerTextView:cellView.msgView withUniqueIdentifier:@(row).stringValue];
+    }
+
     if (auto txtRecording = contactMethods.at([contactMethodsPopupButton indexOfSelectedItem])->textRecording()) {
         [emptyConversationPlaceHolder setHidden:txtRecording->instantMessagingModel()->rowCount() > 0];
         txtRecording->setAllRead();