diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index 63b6408f32..66a7b50914 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -32,9 +32,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -1481,7 +1483,8 @@ BTextView::AcceptsPaste(BClipboard *clipboard) bool BTextView::AcceptsDrop(const BMessage *inMessage) { - if (fEditable && inMessage && inMessage->HasData("text/plain", B_MIME_TYPE)) + if (fEditable && inMessage && (inMessage->HasData("text/plain", B_MIME_TYPE) + || inMessage->HasData("refs", B_REF_TYPE))) return true; return false; @@ -4808,6 +4811,7 @@ BTextView::_MessageDropped(BMessage *inMessage, BPoint where, BPoint offset) ssize_t dataLen = 0; const char *text = NULL; + entry_ref ref; if (inMessage->FindData("text/plain", B_MIME_TYPE, (const void **)&text, &dataLen) == B_OK) { text_run_array *runArray = NULL; @@ -4829,6 +4833,9 @@ BTextView::_MessageDropped(BMessage *inMessage, BPoint where, BPoint offset) } Insert(dropOffset, text, dataLen, runArray); + } else if (inMessage->FindRef("refs", &ref) == B_OK) { + BPath path(&ref); + Insert(dropOffset, path.Path(), strlen(path.Path())); } return true; diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index e4fa7b3ce0..c69f5ae9c5 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -103,7 +103,7 @@ const float kCountViewWidth = 76; const uint32 kAddNewPoses = 'Tanp'; const uint32 kAddPosesCompleted = 'Tapc'; const int32 kMaxAddPosesChunk = 50; -const uint32 kMaxTextClippingSize = 64 * 1024; + namespace BPrivate { extern bool delete_point(void *); @@ -6716,72 +6716,6 @@ BPoseView::DragSelectedPoses(const BPose *pose, BPoint clickPoint) EachPoseAndModel(fSelectionList, &AddPoseRefToMessage, &message); - // do any special drag&drop handling - if (fSelectionList->CountItems() == 1) { - // for now just recognize text clipping files - - BFile file(fSelectionList->ItemAt(0)->TargetModel()->EntryRef(), O_RDONLY); - if (file.InitCheck() == B_OK) { - BNodeInfo info(&file); - char type[B_MIME_TYPE_LENGTH]; - type[0] = '\0'; - - info.GetType(type); - - int32 tmp; - if (strcasecmp(type, kPlainTextMimeType) == 0) { - // got a text file - - - file.Seek(0, SEEK_SET); - off_t size = 0; - file.GetSize(&size); - if (size) { - // clamp the amount of text we extract in order to avoid very unpleasant surprises if, say, the user - // happens to have a 100MB plain text file they want to drag around. - size = min(size, (off_t)kMaxTextClippingSize); - char *buffer = new char[size]; - if (file.Read(buffer, (size_t)size) == size) { - message.AddData(kPlainTextMimeType, B_MIME_TYPE, buffer, (ssize_t)size); - // add text into drag message - - attr_info attrInfo; - if (file.GetAttrInfo("styles", &attrInfo) == B_OK - && attrInfo.size > 0) { - char *data = new char [attrInfo.size]; - file.ReadAttr("styles", B_RAW_TYPE, 0, data, (size_t)attrInfo.size); - int32 textRunSize; - text_run_array *textRuns = BTextView::UnflattenRunArray(data, - &textRunSize); - delete [] data; - message.AddData("application/x-vnd.Be-text_run_array", - B_MIME_TYPE, textRuns, textRunSize); - free(textRuns); - } - } - delete [] buffer; - } - } else if (strcasecmp(type, kBitmapMimeType) == 0 - // got a raw bitmap clipping file - && file.ReadAttr(kAttrClippingFile, B_RAW_TYPE, 0, - &tmp, sizeof(int32)) == sizeof(int32)) { - file.Seek(0, SEEK_SET); - off_t size = 0; - file.GetSize(&size); - if (size) { - char *buffer = new char[size]; - if (file.Read(buffer, (size_t)size) == size) { - BMessage embeddedBitmap; - if (embeddedBitmap.Unflatten(buffer) == B_OK) - message.AddMessage(kBitmapMimeType, &embeddedBitmap); - // add bitmap into drag message - } - delete [] buffer; - } - } - } - } - // make sure button is still down uint32 button; BPoint tempLoc;