? martin_dnd.patch Index: src/af/xap/unix/xap_UnixFrameImpl.cpp =================================================================== RCS file: /cvsroot/abi/src/af/xap/unix/xap_UnixFrameImpl.cpp,v retrieving revision 1.138 diff -a -u -r1.138 xap_UnixFrameImpl.cpp --- src/af/xap/unix/xap_UnixFrameImpl.cpp 8 Mar 2007 02:51:00 -0000 1.138 +++ src/af/xap/unix/xap_UnixFrameImpl.cpp 8 Mar 2007 05:21:14 -0000 @@ -60,6 +60,7 @@ #include "xap_Strings.h" #include "xap_Prefs.h" #include "ap_FrameData.h" +#include "ev_Mouse.h" #include "ie_types.h" #include "ie_imp.h" @@ -389,9 +390,31 @@ formatList[1] = 0; XAP_UnixApp * pApp = static_cast(XAP_App::getApp ()); - - UT_DEBUGMSG(("DOM: s_drag_data_get_cb(%s)\n", targetName)); - + XAP_Frame * pFrame = pApp->getLastFocussedFrame(); + if(!pFrame) + return; + FV_View * pView = static_cast(pFrame->getCurrentView()); + if(!pView) + return; + UT_DEBUGMSG(("UnixFrameImpl: s_drag_data_get_cb(%s)\n", targetName)); + EV_EditMouseContext emc = pView->getLastMouseContext(); + if(emc == EV_EMC_VISUALTEXTDRAG) + { + const UT_ByteBuf * pBuf = pView->getLocalBuf(); + gtk_selection_data_set (selection, + selection->target, + 8, + (guchar *) pBuf->getPointer(0), + pBuf->getLength()); + } + if(emc == EV_EMC_IMAGE) + { + return; + } + if(emc == EV_EMC_POSOBJECT) + { + return; + } if (pApp->getCurrentSelection((const char **)formatList, &data, &dataLen, &formatFound)) { UT_DEBUGMSG(("DOM: s_drag_data_get_cb SUCCESS!\n")); Index: src/text/fmt/unix/fv_UnixVisualDrag.cpp =================================================================== RCS file: /cvsroot/abi/src/text/fmt/unix/fv_UnixVisualDrag.cpp,v retrieving revision 1.1 diff -a -u -r1.1 fv_UnixVisualDrag.cpp --- src/text/fmt/unix/fv_UnixVisualDrag.cpp 22 Jan 2007 11:03:53 -0000 1.1 +++ src/text/fmt/unix/fv_UnixVisualDrag.cpp 8 Mar 2007 05:21:15 -0000 @@ -18,10 +18,50 @@ */ #include "fv_UnixVisualDrag.h" +#include "fv_View.h" +#include "ap_UnixFrameImpl.h" + +static const GtkTargetEntry targets[] = { + {"text/rtf", 0, 0}}; FV_UnixVisualDrag::FV_UnixVisualDrag (FV_View * pView) - : FV_VisualDragText (pView) -{} + : FV_VisualDragText (pView),m_bDragOut(false) +{ + +} FV_UnixVisualDrag::~FV_UnixVisualDrag() -{} +{ + +} + +void FV_UnixVisualDrag::mouseDrag(UT_sint32 x, UT_sint32 y) +{ + UT_DEBUGMSG(("Mouse drag x=%d y=%d \n",x,y)); + if(x> 0 && x < m_pView->getWindowWidth()) + { + m_bDragOut = false; + _mouseDrag(x,y); + return; + } + if(!m_bDragOut) + { + XAP_Frame * pFrame = static_cast(m_pView->getParentData()); + AP_UnixFrameImpl * pFI = static_cast(pFrame->getFrameImpl()); + GtkWidget * pDrawingArea = pFI->getDrawingArea(); + GtkTargetList *target_list = gtk_target_list_new(targets, G_N_ELEMENTS(targets)); + GdkDragContext *context = gtk_drag_begin(pDrawingArea, target_list, + (GdkDragAction)(GDK_ACTION_COPY ), 1, NULL); + gdk_drag_status(context, GDK_ACTION_COPY, 0); + gtk_target_list_unref(target_list); + m_bDragOut = true; + getGraphics()->setClipRect(getCurFrame()); + m_pView->updateScreen(false); + getGraphics()->setClipRect(NULL); + setMode(FV_VisualDrag_NOT_ACTIVE); + return; + } + m_bDragOut = true; + +} + Index: src/text/fmt/unix/fv_UnixVisualDrag.h =================================================================== RCS file: /cvsroot/abi/src/text/fmt/unix/fv_UnixVisualDrag.h,v retrieving revision 1.1 diff -a -u -r1.1 fv_UnixVisualDrag.h --- src/text/fmt/unix/fv_UnixVisualDrag.h 22 Jan 2007 11:03:53 -0000 1.1 +++ src/text/fmt/unix/fv_UnixVisualDrag.h 8 Mar 2007 05:21:15 -0000 @@ -27,6 +27,9 @@ public: FV_UnixVisualDrag (FV_View * pView); virtual ~FV_UnixVisualDrag(); + virtual void mouseDrag(UT_sint32 x, UT_sint32 y); + private: + bool m_bDragOut; }; #endif /* FV_UNIXVISUALDRAG_H */ Index: src/text/fmt/xp/fv_View.cpp =================================================================== RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.cpp,v retrieving revision 1.1171 diff -a -u -r1.1171 fv_View.cpp --- src/text/fmt/xp/fv_View.cpp 5 Mar 2007 09:55:02 -0000 1.1171 +++ src/text/fmt/xp/fv_View.cpp 8 Mar 2007 05:21:16 -0000 @@ -769,6 +769,10 @@ notifyListeners(AV_CHG_MOTION | AV_CHG_HDRFTR); } +const UT_ByteBuf * FV_View::getLocalBuf(void) +{ + return m_pLocalBuf; +} // // This copies a range into a local buffer. // @@ -9663,7 +9667,7 @@ { m_prevMouseContext = EV_EMC_POSOBJECT;; xxx_UT_DEBUGMSG(("Over positioned object \n")); - return EV_EMC_POSOBJECT;; + return EV_EMC_POSOBJECT; } } Index: src/text/fmt/xp/fv_View.h =================================================================== RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.h,v retrieving revision 1.399 diff -a -u -r1.399 fv_View.h --- src/text/fmt/xp/fv_View.h 5 Mar 2007 03:59:10 -0000 1.399 +++ src/text/fmt/xp/fv_View.h 8 Mar 2007 05:21:16 -0000 @@ -432,7 +432,7 @@ void btn0VisualDrag(UT_sint32 x, UT_sint32 y); FV_VisualDragText * getVisualText(void) { return &m_VisualDragText;} - + const UT_ByteBuf * getLocalBuf(void); //--------- //Visual Inline Image Drag stuff Index: src/text/fmt/xp/fv_VisualDragText.cpp =================================================================== RCS file: /cvsroot/abi/src/text/fmt/xp/fv_VisualDragText.cpp,v retrieving revision 1.58 diff -a -u -r1.58 fv_VisualDragText.cpp --- src/text/fmt/xp/fv_VisualDragText.cpp 16 Jan 2007 23:14:39 -0000 1.58 +++ src/text/fmt/xp/fv_VisualDragText.cpp 8 Mar 2007 05:21:16 -0000 @@ -163,6 +163,11 @@ void FV_VisualDragText::mouseDrag(UT_sint32 x, UT_sint32 y) { + _mouseDrag(x,y); +} + +void FV_VisualDragText::_mouseDrag(UT_sint32 x, UT_sint32 y) +{ // // Don't try to drag the entire document. // Index: src/text/fmt/xp/fv_VisualDragText.h =================================================================== RCS file: /cvsroot/abi/src/text/fmt/xp/fv_VisualDragText.h,v retrieving revision 1.13 diff -a -u -r1.13 fv_VisualDragText.h --- src/text/fmt/xp/fv_VisualDragText.h 22 Jan 2007 11:03:54 -0000 1.13 +++ src/text/fmt/xp/fv_VisualDragText.h 8 Mar 2007 05:21:16 -0000 @@ -49,7 +49,7 @@ void setMode(FV_VisualDragMode iVisualDragMode); FV_VisualDragMode getVisualDragMode(void) const { return m_iVisualDragMode;} - void mouseDrag(UT_sint32 x, UT_sint32 y); + virtual void mouseDrag(UT_sint32 x, UT_sint32 y); void mouseCut(UT_sint32 x, UT_sint32 y); void mouseCopy(UT_sint32 x, UT_sint32 y); void mouseRelease(UT_sint32 x, UT_sint32 y); @@ -65,8 +65,12 @@ { return m_bNotDraggingImage;} bool isDoingCopy(void) { return m_bDoingCopy;} -private: + UT_Rect * getCurFrame(void) + { return &m_recCurFrame;} + protected: + void _mouseDrag(UT_sint32 x, UT_sint32 y); FV_View * m_pView; +private: FV_VisualDragMode m_iVisualDragMode; GR_Image * m_pDragImage; UT_sint32 m_iLastX;