• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disabling Display of JPG and PDF Files in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling Display of JPG and PDF Files in NSTextView


  • Subject: Re: Disabling Display of JPG and PDF Files in NSTextView
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 15 Sep 2005 07:05:30 -0400


On Sep 15, 2005, at 4:36 AM, Kirt Cathey wrote:

Scott,

I can only agree with your comments about PDF, but that is not the point of offering an NSTextView class to the development community. Emphasis on TEXT. That is why they should have created a NSPdfView for viewing pdf and jpg files. There should be some kind of flag to turn that behavior off, and I intend to request it.

Actually, the emphasis is not on TEXT, but on a full multi-media text editing experience. Inserting images into a text flow is part of that experience, and is largely the behavior that users and developers want. File types that can be imaged by NSImage are expanded. You're looking at the situation with only your problem in mind, and not the more general case.


Feel free to request the feature add, but you'll need to make a case for it. And in order to do that you'll need to take a different approach than you are now. Describe WHY it's important to have this additional functionality, rather than stating that the current behavior (which is some 10 years old or so) is just wrong.

In fact, I'd suggest asking not for this behavior to be changed, but for a delegate method on NSTextView that would allow you to intercept the text attachment creation process when a file is dragged into an NSTextView instance so that you could handle creating the attachment yourself easier. This gives you a general purpose delegate method that would allow much more flexibility in handling your specific situation, as well as many more general issues with intercepting drag and drop of file types and text attachment creation.



So, now we're getting somewhere.... I have to go as far as subclassing NSTextAttachmentCell to change this behavior?

Someone else suggested just explicitly setting the image for the attachment cell once you know that it is an imaged type rather than a file type (or even better, just ALWAYS set it to the file icon, instead of testing for those types). That may work, but I think you'd need to loop through the attachments after the attribute string contents are loaded, resetting the image for the attachment cell's, and then assign that attributed string to the NSTextView if you do it this way.


But you'll still need to override the NSTextView drag and drop for when new items are dragged into the text view.

Malcolm >> Apologies for the rant. Will keep it to a minimum going forward.

mmalc isn't the only moderator. I am as well, as is Matt Formica.. mmalc just pulls the trigger more often. By and large rants don't get a great reception.



Does anybody have an example of this... I cannot be the only person that has an issue with this. Just point me somewhere that even hints at a solution. Sample code would be great.

Like I said, override the drag and drop methods for NSTextView and handle those types (and likely any type that NSImage can expand, so gif, png, PICT, TIFF, the list is pretty long, but NSImage should provide you with the supported file types) by yourself.


    And ask for that delegate method enhancement.



------------------------- Kirt S. Cathey http://www.bizolutions.com -------------------------





From: Scott Anguish <email@hidden>
To: Kirt Cathey <email@hidden>
CC: email@hidden, email@hidden
Subject: Re: Disabling Display of JPG and PDF Files in NSTextView
Date: Thu, 15 Sep 2005 02:12:06 -0400


On Sep 14, 2005, at 11:53 PM, Kirt Cathey wrote:


Just one more rant.... it is rediculous to have to go through so much to disable such a feature. Where does one go to submit a Cocoa feature request to have this disabled? Most implementors of NSTextView will NOT want a pdf to display in a text view. Admittedly, some may.... those who are writing PDF Viewers (like we need a dozen or so more of those) or parsing PDF files, but the vast, vast majority of programmers do not want this. At the very minimum, there should be a flag within NSTextView that programmers flip with YES or NO to turn this feature off.




I think I'd disagree with this assessment. PDF is an excellent, portable means of representing line art in a scalable fashion. TIFF and other bitmap formats simply don't work for this, and rendering that art at hi-DPI to make it "scale" isn't a great alternative. While many people may thing multi-page files for PDF, they're equally valid for images and figures in place of, say, EPS.

Images are displayed inline, and that's the common requirement. If you need it to behave otherwise, that's a special case, and can be handled by overriding NSTextView and handling those drag and drop events yourself, subclassing the attachment cell class if necessary.






_________________________________________________________________
無料でメールボックス250MBの 「MSN Hotmail」 http:// messenger.msn.co.jp/



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Disabling Display of JPG and PDF Files in NSTextView (From: "Kirt Cathey" <email@hidden>)

  • Prev by Date: Re: Disabling Display of JPG and PDF Files in NSTextView
  • Next by Date: Re: null selector
  • Previous by thread: Re: Disabling Display of JPG and PDF Files in NSTextView
  • Next by thread: Re: Disabling Display of JPG and PDF Files in NSTextView
  • Index(es):
    • Date
    • Thread