Re: Objective-C selector names in disassembly

2022-04-03 Thread Martin Wierschin via Cocoa-dev
ote: > > Yes. Are you disassembling a release version or a debug version? > >> On Apr 3, 2022, at 2:36 PM, Martin Wierschin via Cocoa-dev >> wrote: >> >> Hi everyone, >> >> I have a question that's been an irritating me for a long time. Is there any &

Re: Objective-C selector names in disassembly

2022-04-03 Thread Martin Wierschin via Cocoa-dev
;t bother to do this during debugging. Oh well. Thanks again! ~Martin Wierschin > On Apr 3, 2022, at 1:55 PM, dev.iceberg wrote: > > Hopper Disassembler ? > > Envoyé de mon iPhone > >> Le 3 avr. 2022 à 21:36, Martin Wierschin via Cocoa-dev >> a écrit : >&g

Objective-C selector names in disassembly

2022-04-03 Thread Martin Wierschin via Cocoa-dev
ow things were implemented. I forget when this changed. I know it was triggered by optimizations to the Obj-C runtime. But not being able to see selector names is like being blindfolded. Is there a good way to discover this information in the modern runtime / toolchains? Thanks for any tips! ~M

Re: Several different NSUserDefaults in the same app?

2021-04-06 Thread Martin Wierschin via Cocoa-dev
d this same approach in my own code. You can extend NSUserDefaults to add methods that provide a fallback value without first registering the values separately via a plist file. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Pl

Re: Exception not being caught in try statement

2021-03-29 Thread Martin Wierschin via Cocoa-dev
ould only use this for testing to gather additional debug information. ~Martin Wierschin > On Mar 26, 2021, at 11:22 AM, Mike Abdullah via Cocoa-dev > wrote: > > This does seem quite surprising. However, here’s the thing: this code is very > strange approach to take. > > Nu

Re: Cocoa dylib access by C program

2020-11-13 Thread Martin Wierschin via Cocoa-dev
WithCapacity:32]; } pure.c #include "MyBridge.h" void RegularFunction() { DoObjectiveCStuff(); } I hope that helps! ~Martin Wierschin > On Nov 13, 2020, at 11:16 AM, Carl Hoefs via Cocoa-dev > wrote: > > I have built an ObjC/Cocoa/Foundat

NSView draws unwanted "seams" for certain zoom factors

2020-10-08 Thread Martin Wierschin via Cocoa-dev
But this is naturally a hack, and not a complete solution. The seams still occur, just less often. Can I somehow opt my view out of implicit layer backing? Is there a modern way to implement zoom now that everything is using layers? Thanks for any help! ~Martin Wierschin

Re: Localization under Catalina

2020-05-27 Thread Martin Wierschin via Cocoa-dev
r translated text doesn't overlap adjacent controls and that kind of thing, but it's going to be awkward and finicky. Autolayout is really the key to making a single set of source xibs from Base.lproj work for all localizations. ~Martin Wierschin Nisus Software /

Re: Localization under Catalina

2020-05-27 Thread Martin Wierschin via Cocoa-dev
ch cleaner. ~Martin Wierschin Nisus Software / Developer Solana Beach ☀️ California ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev

Re: [OT] NSTimer +timerWithTimeInterval:

2020-04-30 Thread Martin Wierschin via Cocoa-dev
ot from the timer's side of things. All that said, the "newData" method name is best changed so as not to confuse anyone who does know the correct naming conventions. ~Martin Wierschin > On Apr 29, 2020, at 3:55 PM, Alex Zavatone via Cocoa-dev > wrote: > > Sandor, it’s

Re: What is the preferred way to set NSTextView content from NSAttributedString?

2020-02-03 Thread Martin Wierschin via Cocoa-dev
es all current text. You should not need to manually call -setNeedsDisplay: on the NSTextView as was suggested earlier. If you're working with the right NSTextStorage then its view should observe the changes and automatically mark any redisplay as needed. ~Martin Wierschin > On Feb 02,

Re: Difficulties with recovering NSAttributedString attachments from saved RTFD

2019-12-01 Thread Martin Wierschin via Cocoa-dev
it myself to be sure, since I don't recall seeing it mentioned explicitly. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at co

Re: Typing with multiple selections in NSTextView

2018-09-20 Thread Martin Wierschin
It can be relatively tricky to enhance the text system in ways not originally conceived of by Apple. Still, NSTextView and friends are overall some nice tools. Best, ~Martin Wierschin > On Sep 19, 2018, at 11:54 PM, Georg Seifert wrote: > > Thanks for the explanation. > >

Re: Typing with multiple selections in NSTextView

2018-09-19 Thread Martin Wierschin
code never sees multiple zero-length selections and never potentially enters unknown states. Good luck! ~Martin Wierschin > On Sep 19, 2018, at 12:13 AM, Georg Seifert wrote: > > Hi > > Is it possible to make NSTextView to allow typing with multiple insertion > points? On

Re: Mac App Store paid upgrades and app settings

2018-08-13 Thread Martin Wierschin
n place the new app version can autodetect this and import the data as needed. Many thanks! ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderat

Re: Mac App Store paid upgrades and app settings

2018-08-13 Thread Martin Wierschin
n alert and folder selection dialog. ~Martin Wierschin > On Aug 13, 2018, at 1:08 PM, Richard Charles wrote: > > >> On Aug 13, 2018, at 10:17 AM, Martin Wierschin wrote: >> >> The new version is to be a paid upgrade, which I know the MAS doesn't really

Mac App Store paid upgrades and app settings

2018-08-13 Thread Martin Wierschin
an open folder dialog, to obtain access, but that seems like a kludge. Does anyone have any other suggestions? Thanks for any advice or ideas! ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests o

Re: How to pre-select a file in NSOpenPanel -- specifically, a .app bundle?

2016-06-24 Thread Martin Wierschin
naturally it was closed as a duplicate. As everyone says, maybe file your own radar report to register a vote with Apple. Though considering how long this functionality has gone missing, I doubt we’ll see any changes– especially if Apple considers this any kind of security risk. ~Mart

Re: Where are my bytes hiding?

2016-05-05 Thread Martin Wierschin
les installed as part of Mac OS X; user > files are typically not compressed (but certainly can be!) Are a lot of system files compressed like this? Is there any way a user file might be compressed in such a way through normal user actions? ~Martin Wierschin ___

Re: undomanger performance

2016-05-02 Thread Martin Wierschin
ion would likely be more efficient than millions of undo invocations each with their own state information. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Co

Re: nsopenpanel no title bar

2016-04-27 Thread Martin Wierschin
> Since 10.11 it seems the title bar no longer appears even when using > setTitle: does anyone know what happened and how to get the old behavior back? I don’t know anything about that, but you can always use -[NSOpenPanel setMessage:] to display relevant information to the user. ~

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-27 Thread Martin Wierschin
That's typed into Mail and may have errors, but you get the idea. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admi

Re: NSWindow

2015-11-30 Thread Martin Wierschin
filed a duplicate. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update

Re: Safe time to add accessory view to NSSavePanel in sandboxed app?

2015-07-17 Thread Martin Wierschin
ly) temporarily unavailable. This time the app crashed while trying to generate that alert; -[NSAlert init] was loading some localized string and crashed[2]. I doubt this is going to be reproducible, but it's reported as rdar://21881669. ~Martin Wierschin [1] INITIAL EXCEPTION: MyApp

Re: NSPredicate or Collection operators?

2015-07-16 Thread Martin Wierschin
iency doesn't matter here, since otherwise your dictionary would be keyed on the "smi" property, but it's a side benefit. If you were concerned about efficiency in this case you could set the test block's stop parameter to YES once you'd found the first match. ~Mar

Re: Safe time to add accessory view to NSSavePanel in sandboxed app?

2015-07-16 Thread Martin Wierschin
el by calling [panel setAccessoryView:nil]. And after reviewing my code, it turns out that my app doesn't recycle/reuse accessory view instances after all. I thought it still did, but that was some time ago, when the open/save panels were slow as death under sandboxing. ~Martin Wierschin >

Re: Safe time to add accessory view to NSSavePanel in sandboxed app?

2015-07-16 Thread Martin Wierschin
n implies that it's safe, as long as you handle the memory management properly: > If you want to reuse the accessory view, you should not rely on the panel to > hold onto the accessory view until the next time you use it; instead, you > should

Re: Why would scroll events not arrive?

2015-06-29 Thread Martin Wierschin
[[self enclosingScrollView] scrollWheel:fakeEvent]; CFRelease(cgEvent); } } [super scrollWheel:event]; } I’m posting this on the off-chance it might be helpful to someone else down the line. ~Martin

Re: Why would scroll events not arrive?

2015-06-26 Thread Martin Wierschin
disrepair. This problem has only been reported by users on OSX 10.10.x. Anyways, I appreciate your reply. I’ll continue to work with my testers and see if I can’t narrow down the cause. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.

Why would scroll events not arrive?

2015-06-26 Thread Martin Wierschin
ason this could happen? Thanks in advance for any ideas on possible causes, ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at coc

Re: NSDocumentTitlebarPopoverViewController zombie on Yosemite

2015-06-10 Thread Martin Wierschin
self, _cmd); } @end I hope that helps, ~Martin Wierschin >>> After enabling Zombie Objects, I get the following in the console: >>> 2015-05-28 14:19:58.291 MyApp[23684:2561441] *** >>> -[NSDocumentTitlebarPopoverViewController isKindOfClass:]: message sent to &g

Re: Crash when move open document based app file to trash

2015-04-15 Thread Martin Wierschin
senter and should cope with access from multiple processes (eg: Jonathan's app and the Finder). ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Con

Re: NSTextView Copy-and-Paste Problem

2015-03-02 Thread Martin Wierschin
> I’m having problems with text attributes getting mangled by copy-and-paste > operations within the selfsame text view. Obviously text pasted in from > outside the app would have an unpredictable set of attributes, but you’d > think copying and pasting in the same text view would leave you with

Re: deny file-read-data after launch

2015-01-14 Thread Martin Wierschin
certain number. But if you only have this one folder you’re not going to run out, nor do much to “leak kernel resources”. ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator com

Re: Predicate warning from text view

2014-10-24 Thread Martin Wierschin
blic.image") I filed it as rdar://17541734 which was marked as a duplicate of rdar://17432480 which is apparently closed now. Perhaps the problem was reintroduced, or this has a different source? In any case, I never observed any actual ill e

Re: Get text with hyphenation

2014-10-09 Thread Martin Wierschin
ethod, so you can't call super. It's only provided to be implemented in subclasses. But you could still perhaps assume that when NSTypesetter calls this method, it intends to insert a hyphen. ~Martin Wierschin ___ Cocoa-dev mail

Re: Get text with hyphenation

2014-10-09 Thread Martin Wierschin
gment using -[NSLayoutManager glyphAtIndex:]. Another potential approach: you might subclass the typesetter and override -[NSTypesetter shouldBreakLineByHyphenatingBeforeCharacterAtIndex:] and record the instances where super returns YES. I hope that helps, ~Martin Wierschin > It wo

Re: NSSpellChecker exception

2014-08-19 Thread Martin Wierschin
.. I can't speak with any authority, but my apps having been ignoring those port exceptions during beta testing for years to good effect. You may also want to add NSAccessibilityException to your ignore list, since it is also seems to be caught by Apple frameworks as necess

Re: document inexplicably becomes locked and fails to save under sandboxing

2014-06-12 Thread Martin Wierschin
ng machinery by returning YES from +autosavesInPlace. Unfortunately setting the key NSURLIsUserImmutableKey to @NO does not solve our particular problem. Thanks all the same for sharing your experience. Best, ~Martin Wierschin ___ Cocoa-dev maili

Re: document inexplicably becomes locked and fails to save under sandboxing

2014-06-12 Thread Martin Wierschin
dbox will eventually show the document as locked and/or deny the user access to the file. Filed as radar://17291335 This is a huge problem for our app, so if anyone has any other tips, I'd be very appreciative. Thank you, ~Martin Wierschin

Re: document inexplicably becomes locked and fails to save under sandboxing

2014-06-11 Thread Martin Wierschin
ler's open methods and match up the file URL to completion handlers I've stashed away somewhere. Not a big deal, but a little ugly. Best, ~Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin r

Re: document inexplicably becomes locked and fails to save under sandboxing

2014-06-11 Thread Martin Wierschin
d document lists. The merits of this particular feature aside, I would expect this to work. It seems an oversight that you can't use bookmark data to reopen documents. I suppose I'll file a radar, though I'll still need to workaround this somehow. Thanks again for your reply, ~Marti

document inexplicably becomes locked and fails to save under sandboxing

2014-06-10 Thread Martin Wierschin
hat restores successful saving, it doesn't prevent "— Locked" from appearing in the document's titlebar. Thank you for any ideas or help! Best, Martin Wierschin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: Getting an index for NSMutableAttributed string using tags in RTF

2014-04-28 Thread Martin Wierschin
NSAttributedString won't load images from RTF, but it will load images from an RTFD package. Very likely it would not understand images specified using the ugly "htmltag" RTF control. You'll probably need to use the proprietary "NeXTGraphic" RTF control instead. You can save an RTFD package wit

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Martin Wierschin
>>> The ruler has flipped to right-aligned, but the text, while running RTL, >>> is laid out flush-left. Why? >> >> Because paragraph alignment and text direction are orthogonal? > > But it means the tabstops on the ruler have no relation to where the > text is laid out on screen. > > And it doe

Re: UnitTest: object Should be Dealllocated

2013-06-27 Thread Martin Wierschin
>> How can I create a Unit Test which tests such cases, e.g.: >> >> Foo* foo; >> @autoreleaspool { >> foo = [Foo new]; >> [foo doSomething]; >> foo = nil; // should deallocate foo >> } >> ASSERT_DEALLOCATED_TRUE(foo); > > Create a __weak reference to foo and assert that it is nil? That'

Re: splitting CJK text into "words"

2012-09-27 Thread Martin Wierschin
> There are the Kinsoku rules with are wrap rules for Japanese. Semantially > similar rules exist for Chinese and Korean. A simple implementation it not > too difficult, see here for a quick overview: > > http://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages Thanks for the li

Re: splitting CJK text into "words"

2012-09-26 Thread Martin Wierschin
>> I've tried a variety of locale identifiers (eg: "zh", "jp_JP", etc) but no >> joy. Am I missing something? > > Try "ja" for Japanese text, "zh-Hans" for Simplified Chinese text, "zh-Hant" > for Traditional Chinese text. Thanks for the idea Douglas, but I just gave all those locale identifier

Re: splitting CJK text into "words"

2012-09-26 Thread Martin Wierschin
>> I'm trying to split CJK text using the kind of word boundaries detected by >> -[NSAttributedString doubleClickAtIndex:]. That method does the job >> correctly, but only if the system preferences have the Word Break mode set >> to Japanese. I need to ensure this kind of word splitting independ

splitting CJK text into "words"

2012-09-26 Thread Martin Wierschin
Hello everyone, I'm trying to split CJK text using the kind of word boundaries detected by -[NSAttributedString doubleClickAtIndex:]. That method does the job correctly, but only if the system preferences have the Word Break mode set to Japanese. I need to ensure this kind of word splitting ind

Re: looking for a memory problem

2012-07-17 Thread Martin Wierschin
> So my potential solution for this is: > > NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; > __block NSRange range = NSMakeRange(0, 0); > while (range.location < [aString length]) { > >dispatch_sync(dispatch_get_main_queue(), ^{ > range = [checker checkSpellingOfString:aS

Re: Dynamic modification of text search results

2012-07-05 Thread Martin Wierschin
> Regarding the other solution--just do another search when the text > changes--you only have to search the range that was changed, not the entire > text storage, right? That doesn't seem like it would be too ungainly. Not too ungainly, no. But then you're maintaining the matches in an external

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Wierschin
> It turns out to be pretty easy for me to add my 'match' objects to the the > text storages. I just needed to make the match class (TPDocumentMatch) a > subclass of NSTextAttachment. Then once I've collected all my matches for a > given file, I do > > [storage beginEditing]; > for (TPDocumen

Re: NSSavePanel default file type

2012-06-12 Thread Martin Wierschin
> Our app allows to export its documents in a variety of formats, such as jpeg, > tiff, png, pdf . Hence, we have set up the NSSavePanel to sport a file types > popup that allows the user to select the desired file type. ... > So, how can I set the item in the popup that is initially selected whe

tons of CFURLCache worker threads?

2012-05-17 Thread Martin Wierschin
Hello all, Does anyone know anything about "com.apple.CFURLCACHE_work_queue" and how many of these queues/threads should be running at once? Normally I wouldn't care about such a detail, and naturally I shouldn't, but I have several collected crash reports where these threads are proliferating.

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
t; On 2012.05.05, at 4:51 PM, Kyle Sluder wrote: >> If I understand Quincey correctly, that's exactly what he's saying: the >> semantics of localizedCaseInsensitiveCompare: might be such that it is not >> appropriate for such algorithms. > > On 2012.05.07, at 1:35

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
>> As Jens mentioned, that doesn't make any sense. What good is a localized >> comparison method if not for sorting a list for display? I suppose you could >> be implying that Cocoa's sorting methods aren't optimized to assume >> comparisons are transitive (or special cases problematic >> strin

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
> So even if we get the right compare options, > 'localizedCaseInsensitiveCompare:' may not be viable for strings *not* in the > language of the current locale. That seems extremely unlikely and would be short-sighted of Apple, considering multilingual users and international information exchan

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
>>> If I'm right, then sort order and search order are different, and you can't >>> expect to use a binary search here. (Not unless you originally used >>> pair-wise 'localizedCaseInsensitiveCompare' to manually sort the list of >>> strings.) >> >> All comparisons, including those used for the

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-05 Thread Martin Wierschin
> If I'm right, then sort order and search order are different, and you can't > expect to use a binary search here. (Not unless you originally used pair-wise > 'localizedCaseInsensitiveCompare' to manually sort the list of strings.) All comparisons, including those used for the original sorting,

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-05 Thread Martin Wierschin
> Are you sure your debugger isn't lying to you? The code behaves the same in the built application. > Maybe you have category on NSString that does that? No, but I also tried the CFStringCompareWithOptionsAndLocale with the same results. I suppose that could call through to an NSString overrid

inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-05 Thread Martin Wierschin
Hello everyone, I'm using NSString's localizedCaseInsensitiveCompare to maintain a data structure sorted by some keys, which are strings that will be displayed to the end-user. For this question it's enough to think of an array of sorted strings, on which binary searches are run. The problem is

Re: addsubview

2012-04-24 Thread Martin Wierschin
> I have searched high and low and can find no reason for a subview to not > display. Is this a trivial problem not worthy of list comment or is it truly > a difficult problem that cannot be dealt with as easily as more mundane > topics found here? You've waited only about 90 minutes since you

Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?

2012-02-14 Thread Martin Wierschin
> I've just been bitten by this. Seems it would be easy to detect at runtime > and assert, is there any magic environment variable or defaults value that > can help me catch such incorrect usage? I've searched but not found... I don't know if there's any runtime/debug value, but this is one of

Re: Update of Typography panel

2012-01-31 Thread Martin Wierschin
>> I was just about to create a dummy NSTextView, when I found the (obvious) >> solution: I have to use [[NSFontManager sharedFontManager] >> setSelectedAttributes:isMultiple:]. This updates the Typography panel (at >> least with 10.7). > > I'm confused. Isn't this precisely what you said _didn

Re: Update of Typography panel

2012-01-31 Thread Martin Wierschin
> But if i set a new active font with [[NSFontManager sharedFontManager] > setSelectedFont:isMultiple:], an already opened Typography panel is not > adjusted to the features of the new font. Instead it continues to show the > features of the last font. > > How can I refresh the Typography panel

Re: ALLOC/FREE problems with a NIB..

2012-01-03 Thread Martin Wierschin
Hi Robert, > I seem to be crashing with the following message: > malloc: *** error for object 0x104839c08: incorrect checksum for freed object > - object was probably modified after being freed. > *** set a breakpoint in malloc_error_break to debug > > However, malloc_error_break never gets call

Re: Allocating too much memory kills my App rather than returning NULL

2011-11-10 Thread Martin Wierschin
>> calloc() and malloc() are documented to return NULL when there isn't >> enough memory to satisfy the user's request. Their implementation is >> simply broken if they don't do that. > > Because calloc and malloc never return, they are not violating the spec. > > Nothing about the POSIX spec re

Re: Printing multiple images each on a separate page using single NSPrintOperation

2011-11-07 Thread Martin Wierschin
> Now when I have multiple pages to print, I would like to print all of them > using a single NSPrintOperation. So basically, I would like to insert > NSImage/NSImageView of each page as a separate page into a single NSView and > use this NSView to print finally using NSPrintOperation. That app

Re: Simple PDF generation code not working as intended

2011-10-14 Thread Martin Wierschin
> I am trying a simple application to generate pdf from contents in a text view. Your content view is just a single NSTextView, which won't create a multi-page PDF for you. What you see on screen is what you get when you make a PDF. You need to create a chain of multiple NSTextView instances (o

Re: debugging crashes in dyld?

2011-09-28 Thread Martin Wierschin
> Crashes inside dyld or libobjc during library load often has one of two > causes: > 1. A library binary on disk or in the dyld shared cache is corrupted. > 2. A memory error earlier in the app corrupted a data structure, and that > data structure went unused until library load time. Thank you

debugging crashes in dyld?

2011-09-27 Thread Martin Wierschin
Hello everyone, I have a user reporting a crash whenever they try to first save a file. It is reproducible for the user (though not be me) and I'm wondering how to best debug this problem remotely. I've included the crash stack below (all other threads are waiting/trapped). I'm no expert on dy

Re: Garbage Collection: memory limits, crash when using "lots" of memory, why?

2011-09-23 Thread Martin Wierschin
>> I think crashing is a fine behavior when one is really out of memory (eg: >> it's not even possible to alloc a single vanilla NSObject), or when using >> Cocoa classes that aren't memory allocators (pretty much everything besides >> NSData). But in this case, where he's requesting big chunks

Re: Garbage Collection: memory limits, crash when using "lots" of memory, why?

2011-09-23 Thread Martin Wierschin
>> Exceeding the available memory of the garbage collector should not crash, >> instead your allocations should fail. > > When memory allocations fail, apps crash. Like it or not, that's just the way > it is. Not sure what the alternative would be - Changing all (!) of our code > to handle out-

Re: using AppKit additions in background threads

2011-09-07 Thread Martin Wierschin
> I've found that NSAttributedString's initWithData:... method does a good job > of the conversion ... > One drawback to my approach is that I can't get the web page title using > NSAttributesString. When you init the NSAttributedString, you can pass in a pointer to a document attributes dictio

Re: Getting notification about new font is available

2011-09-06 Thread Martin Wierschin
> During weekend I was trying to figure out how to know when new font becomes > available. You can use NSFontSetChangedNotification: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSFont_Class/Reference/Reference.html Though in my experience it's po

Re: Possible causes of "attempted layout while textStorage is editing"?

2011-09-02 Thread Martin Wierschin
>> On 01/09/2011, at 8:52 PM, jonat...@mugginsoft.com wrote: >> >> Is it possible that the user is editing the textview when this code is >> triggered? >> From the looks of the trace you react directly to the mouseDown event in >> another view which might not give NSTextView opportunity to concl

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
>> Offhand does anyone know how to inspect the architecture(s) of a plain >> executable file? I've been googling for a little bit and haven't hit upon >> anything that works yet. > > Use NSTask to launch lipo -info. (It's part of the standard install; does not > require dev tools.) Thank you S

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
>> The problem is that this ancillary program is sometimes Intel-only, or >> sometimes PPC-only, while the main application is Universal. The use of this >> ancillary program is not mandatory, so displaying an error message, or using >> a fallback solution is acceptable. The issue is that trying

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
>> Thanks for your reply. I was hoping to avoid handling that inspection >> myself, but even if I go that route there's another problem: the ancillary >> tool isn't a proper bundle, it's just a plain executable, so NSBundle's >> initializers will just return nil. That's a pity because there's ev

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
values > matches the architecture of the machine you're running. If it matches, then > launch the task. :) > > Cheers, > > Dave > > On Sep 1, 2011, at 2:09 PM, Martin Wierschin wrote: > >> Hello all, >> >> My application sometimes need to r

determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
Hello all, My application sometimes need to run an ancillary program (included in the app's resources). I do this via NSTask and normally it works great. The problem is that this ancillary program is sometimes Intel-only, or sometimes PPC-only, while the main application is Universal. The use

Re: Size of a file on disk

2011-08-31 Thread Martin Wierschin
>>> NSFileHandle *hndl = [NSFileHandle fileHandleForReadingAtPath:path]; >>> long long lngth = [hndl seekToEndOfFile]; >>> >>> This gets you the length in bytes. >> >> And loads the entire file into memory!! > > Does it? I didn't think seek loaded anything, and it was just for

Re: Won't Applescript command use defined ivars?

2011-08-31 Thread Martin Wierschin
> But I am going to need the application to use the instance of the class from > when it's started, not make a new instance every time the script command is > given. As Scott mentioned, that's not how the Cocoa framework works with regard to AppleScript. It's going to create a new instance of y

Re: Possible causes of "attempted layout while textStorage is editing"?

2011-08-31 Thread Martin Wierschin
> _fillLayoutHoleForChar acterRange:desiredNumberOfLines:isSoft: *** attempted > layout while textStorage is editing. It is not valid to cause the > layoutManager to do layout while the textStorage is editing (ie the > textStorage has been sent a beginEditing message without a matching > endEdi

Re: Won't Applescript command use defined ivars?

2011-08-30 Thread Martin Wierschin
> If I have an ivar that is global in scope, As Scott mentioned, your ivar isn't global. Each instance of your class has its own ivar. Also as he mentioned, you seem to be ignoring the memory management guidelines. That's not the immediate cause of your troubles, but is important for you to und

Re: Catching actions of fonts "Typography" panel

2011-08-24 Thread Martin Wierschin
> Delegate methods could be used if there is an editable textview. But what if > not? For other things we have "changeFont:, changeColor:, > changeAttributes:". Unfortunately, neither of them are called by action I > have mentioned. The actions you mentioned, font typography options set via Appl

Re: Properly wrapping non-contiguous NSTextViews

2011-08-15 Thread Martin Wierschin
>> I don't know the particulars of your situation or what might be triggering >> the cutoff display (are they just descenders?), but have you tried reducing >> the height of the NSTextContainer while keeping your NSTextView height the >> same? (You'll have to disable automatic resizing). > > I

Re: Properly wrapping non-contiguous NSTextViews

2011-08-14 Thread Martin Wierschin
I think Ross's confusion stems from your statement that: >>> There is one NSLayoutManager and one NSTextStorage behind each text view You make it sound as if a single NSTextView is responsible for completely showing all the text in each NSTextStorage. In other words, that each of your NSLayoutM

Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-08-02 Thread Martin Wierschin
>> When you unarchive one of those strings, code expecting an instance of >> UnencodableFoo will instead have an NSString, the use of which will likely >> throw exceptions, eg: when code calls -[UnencodableFoo fooThing] > > No, it's not likely if UnencodableFoo is *my* code, because I program >

Re: NSAttributedString -initWithPath RTFD crash on Lion

2011-08-01 Thread Martin Wierschin
I don't have any advice on the actual crash, but: > The following workaround seems reliable: > > // get path to rtf file > NSString *filePath = [path stringByAppendingPathComponent:@"TXT.rtf"]; Be aware that would probably miss any images/attachments saved in the RTFD package. ~Martin ___

Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-08-01 Thread Martin Wierschin
>>> I don't think so, Jens. "They" is Apple. Apple has the source code for >>> -initWithCoder: and -encodeWithCoder:. >> >> No they don’t — not for the implementations of those methods in our own >> classes… > > Thank you, Jens. I see the problem. > > Here's a fairly radical solution: ...

Re: A trap with full screen in Lion

2011-07-29 Thread Martin Wierschin
> I just came across a bit of an issue with the full screen mode in Lion: if > you have a view and use [[self window] windowController] to get at your > window controller, it will return nil in full screen mode. The window gets > swapped out with an NSToolbarFullScreenWindow, which doesn't have

Re: Extending NSTextStorage

2011-05-11 Thread Martin Wierschin
> I try to subclass NSTextStorage and use it in text view ... > So I try to use delegate, to handle all needed events with same functionality: Although it might be natural to say that your MyTextStorage class "delegates" storage to an NSMutableAttributedString, it's not a good word to use here,

Re: [NSMenu _enableItem} crash

2011-05-04 Thread Martin Wierschin
> Most of the time the stack ends with: > > 0 objc_msgSend > 1 stub helpers > 2 [NSMenu _enableItem] > > Occasionally it consists of > 0 objc_msgSend > 1 ??? (or a reasonable facsimile) > > After reading through some threads on this I thought my validation stuff may > be an issue Likely menu v

Re: Faster text drawing with configurable stroke width

2011-03-16 Thread Martin Wierschin
> I'm currently drawing text one character at a time with -[NSAttributedString > drawWithRect:options:], and it is really slow. I'm looking for a faster > alternative. > > I draw one character at a time because I need exact control over horizontal > positioning (regardless of whether the font i

Re: RTFDFromRange returns different data

2010-11-12 Thread Martin Wierschin
I workedaround the problem archiving the data directly from the attributedString this way: NSData* stringData = [NSKeyedArchiver archivedDataWithRootObject:mTextMutableString]; That's not guaranteed to always give you the same NSData either. Maybe it works now for your small test case, bu

Re: What is the expected Cocoa API behavior in an incomplete object traversal?

2010-10-15 Thread Martin Wierschin
Well, in a normal situation the array would contain conforming objects. However, as it can happen once in a while, one can add an object to an array thinking it's of one type when in fact it's another. When you say "one can add", do you mean that the user chooses these objects in the GUI

Re: NSMutableDictionary crash on PPC

2010-09-29 Thread Martin Wierschin
On Sep 29, 2010, at 16:02, Trygve Inda wrote: There is example code here (2nd example) that removes before setting too. http://stackoverflow.com/questions/1024938/renaming-keys-in-nsmutabledictionary That 2nd example shouldn't be followed. Either retain the value obtained from the dictio

Re: Cocoa Text System - Temporarily Disabling Layout

2010-09-24 Thread Martin Wierschin
when I resize the window and need to adjust the frames of both scroll views, calling -[NSTextView setFrame:] results in the layout manager invalidating and ensuring layout for the newly visible character range. Why not just turn off text view width/height tracking for the container during

  1   2   >