Re: Creating NSButton in Code does not set controlTint to currentControlTint

2013-12-28 Thread Uli Kusterer

On 27 Dec 2013, at 04:08, Peter Teeson  wrote:

> On 2013-12-26, at 7:01 PM, Uli Kusterer  wrote:
>> On 26 Dec 2013, at 18:49, Peter Teeson  wrote:
>>>   _Cancel = [[NSButton alloc]init];
>>>   [_Cancel setFrame:theButtonFrame];
>>>   [_Cancel setNeedsDisplay:YES];
>> 
>> Several issues here:
>> 
>> 1) Control tints only apply to window widgets, focus borders, token capsules 
>> and to Aqua UI. MacOS X 10.7 removed the last aqua buttons and replaced them 
>> with grey, tint-less buttons. So whatever tint you set, you won’t see it 
>> anymore these days. Those grey, tint-less buttons look very similar to some 
>> other button types these days.
>> 
>> 2) When you create a new NSButton, it is by default set up to look like a 
>> NeXT-style button. You need to set its bezel to NSRoundedBezelStyle to get a 
>> Mac-style button. NeXT-style buttons don’t honour the tint either. So the 
>> code you posted isnot identical to the button you create in IB. Hence, even 
>> if you’re running on 10.6 or earlier where buttons still show the tint, it’s 
>> not surprising that your button looks different.
>> 
>> 3) As others mentioned, buttons are usually set to “default”. To find out 
>> what that corresponds to, look at NSColor’s currentControlTint method.
> Thanks for your comments Uli. The docn in Color Programming Topics Using the 
> System Control Tint says this:
> 
> OS X allows a user to set the color used in the display of windows, menus and 
> controls using the Appearance pane in System Preferences. This color is 
> referred to as the control tint. User interface elements provided by the 
> Application Kit automatically modify their appearance based on the current 
> control tint.
> 
> I understand this to mean that NSButton, which inherits directly from 
> NSControl, and which is a user interface element in the App Kit, should be 
> using the Aqua tint as default assuming it's set to Blue in the System 
> preferences.

 Nope. The tint is a special feature of some button types. It is not something 
that all button bezels do. E.g. NSShadowlessSquareBezelStyle *never* (at least 
not since the introduction of Aqua in 10.0 — it might have been different in 
Mac OS X Server 1.0 which still had the OS 9 “Platinum” appearance) drew using 
the tint.

 The only things in 10.0 that used the tint were Rounded (highlight/default 
buttons) and Circle bezel buttons (only to highlight), menu selections, tab 
controls, popup buttons, segmented controls, progress bars and scroll bars. 
Also the apple in the menu bar. Furthermore, window widgets were colored (red, 
yellow, green) with the blue tint, but had the same graphite tint under 
graphite.

> My code which you referred to was merely to show that I had tried, based to 
> the Designated Initializers value statement, to use the default init. To try 
> and make clear what my code is without the debug here it is again 
> (theButtonFrame has been calculated prior to this code):
> _Cancel= [[NSButton alloc]initWithFrame:theButtonFrame];
> [_Cancel setTitle:@"Cancel"];
> [_Cancel setButtonType:NSToggleButton];
> [_Cancel setState:NSOffState];
> [_Cancel setBordered:YES];
> [_Cancel setBezelStyle:NSShadowlessSquareBezelStyle]; 
> [_Cancel.cell setControlTint:NSBlueControlTint];
> [theContentView addSubview:_Cancel];
> 
> To repeat… I expected the above code to produce a button which when pressed 
> displays the Blue Aqua tint. It doesn't! Why not?
> Why does it show the Aqua tint if I set up the exact same button using IB and 
> let it be instantiated from the nib?
> Because that's where I got the information for the above set… statements. In 
> my naiveté I assumed I would get the same behaviour.

 What are you trying to achieve with all this? What do you mean by “display the 
blue aqua tint”? I think you’re misunderstanding the terminology. The tint is a 
color that is used for accents on *some* controls to make important parts stand 
out more, and to show whether a button is clickable even when its window is 
inactive. On pushbuttons, the tint was ever only used for the default button 
(the one that reacts to the return key) and for click-highlighting a button. 
The OS does that correctly and automatically, there is no reason for you to 
change this. The tint is *not* a way to theme a button or give it a particular 
color.

 Also, Apple has reduced the number of places where this tint is still used 
with redesigns of the window titles, scrollbar and button shapes. So you rarely 
see the tint anymore.

 Are you perhaps mixing up the control tint (which is conceptually like “a 
color accents are drawn in”) and the pulsing default button appearance (which 
is an unrelated feature that just uses this color)? In that case, you need to 
create a button of rounded bezel with the keyboard shortcut set to return 
(“\r").

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_

Re: Creating NSButton in Code does not set controlTint to currentControlTint

2013-12-28 Thread Uli Kusterer
On 28 Dec 2013, at 14:39, Uli Kusterer  wrote:
> The only things in 10.0 that used the tint were Rounded (highlight/default 
> buttons) and Circle bezel buttons (only to highlight), menu selections, tab 
> controls, popup buttons, segmented controls, progress bars and scroll bars. 
> Also the apple in the menu bar. Furthermore, window widgets were colored 
> (red, yellow, green) with the blue tint, but had the same graphite tint under 
> graphite.

Oops. Forgot to mention checked checkboxes and radio buttons. Anyway, the point 
I’m making is: It’s a selectively used accent color. You rarely see it on 
arbitrary buttons, least of all the square type you’re using in your sample 
code.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Ugly Inspector Bar in TextView

2013-12-28 Thread Gerriet M. Denkmann
I created a new project (10.9.1, Xcode 5.0.2) not document based.
Put a TextView into the window and made constraints to the 4 sides = Default.
Clicked (selected) "Inspector Bar" for the TextView.
Build and Run.

Window shows, TextView has Inspector Bar, but the right half is obscured by 
some strange rectangle.

When I make the window in Xcode less wide, the size of the strange rectangle 
also gets smaller.

How can I avoid this strange rectangle? 
(Can someone reproduce this, or is it only on my computer?)

Gerriet.


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Creating NSButton in Code does not set controlTint to currentControlTint

2013-12-28 Thread Uli Kusterer
On 28 Dec 2013, at 14:39, Uli Kusterer  wrote:
>> To repeat… I expected the above code to produce a button which when pressed 
>> displays the Blue Aqua tint. It doesn't! Why not?
>> Why does it show the Aqua tint if I set up the exact same button using IB 
>> and let it be instantiated from the nib?
>> Because that's where I got the information for the above set… statements. In 
>> my naiveté I assumed I would get the same behaviour.
> 
> What are you trying to achieve with all this? What do you mean by “display 
> the blue aqua tint”? I think you’re misunderstanding the terminology. The 
> tint is a color that is used for accents on *some* controls to make important 
> parts stand out more, and to show whether a button is clickable even when its 
> window is inactive. On pushbuttons, the tint was ever only used for the 
> default button (the one that reacts to the return key) and for 
> click-highlighting a button. The OS does that correctly and automatically, 
> there is no reason for you to change this. The tint is *not* a way to theme a 
> button or give it a particular color.

 Are you perhaps trying to implement “sticky” buttons? I.e. buttons that toggle 
between on and off when clicked? These haven’t highlighted in blue for a long 
time, but may have in 10.1 or earlier, I’m not sure anymore. Anyway, if you 
want that, that depends on the button type. I see you’re setting that to 
NSToggleButton. A toggle button only changes the image/alt image when clicked. 
Maybe you want NSPushOnPushOff button, which according to the docs highlights 
the button when pressed, too? This highlight is usually grey, not in the 
control tint, but maybe that’s what you’re looking for?

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Should copy + paste change characters?

2013-12-28 Thread Uli Kusterer

On 27 Dec 2013, at 11:22, Gerriet M. Denkmann  wrote:

> 
> On 27 Dec 2013, at 15:23, Ken Thomases  wrote:
> 
>> On Dec 27, 2013, at 2:01 AM, Gerriet M. Denkmann wrote:
>> 
>>> When I have a rich text (with the font set to Heiti SC Light), which 
>>> contains these three lines:
>>> 
>>> L'œuf de volaille = 鸡卵  Note: LATIN SMALL LIGATURE OE
>>> traditional: "盧" simplified: "卢" Note: CJK COMPATIBILITY IDEOGRAPH-F933
>>> traditional: "雞" simplified: "鸡"
>>> 
>>> and I select all and copy it into another rich text, I get:
>>> 
>>> L'oeuf de volaille = 鸡卵 Note: LATIN SMALL LIGATURE OE
>>> traditional: "卢" simplified: "卢" Note: CJK COMPATIBILITY IDEOGRAPH-F933
>>> traditional: "雞" simplified: "鸡"
>>> 
>>> In the second rich text the start of the egg has changed to "oe" (which is 
>>> just NOT correct French) and the difference between traditional and 
>>> simplified for "black" is no longer discernible (while this difference is 
>>> still visible for "chicken").
>>> 
>>> Note that all characters are part of Heiti SC Light; no font substitution 
>>> has taken place nor is necessary.
>>> 
>>> Is this correct behaviour, or should one be able to trust "copy" to put the 
>>> copied text unmodified to the rich pasteboards?
>> 
>> In what app or with what code does this happen?  I'm not seeing it with 
>> TextEdit on Mac OS X 10.6.
> 
> On 10.9.1 (I don't have 10.6) I do see it with TextEdit:
> 
> Copy the text from this eMail into a TextEdit window
> use Edit → Special Characters... to change 盧 back to CJK COMPATIBILITY 
> IDEOGRAPH-F933
> Select all
> Set the font to Heiti SC Light
> copy and paste into another rich TextEdit window

 FWIW, Mail uses a WebView for its text editing, while TextEdit uses a Cocoa 
NSTextView. May be a clue.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Uli Kusterer

On 27 Dec 2013, at 13:52, Trygve Inda  wrote:

> I have a document with a SourceView on the left side (like iTunes). Some
> main menu commands pertain to actions in the Source View. This works fine if
> the SourceView is the active view but my window has other views held in a
> SplitView.
> 
> If a sibling of the SourceView is active, the SourceView is not in the
> responder chain and thus my menu commands are greyed out.
> 
> How can I keep a sibling view in the responder chain?
> 
> The alternative is I have to re-create "passthrough" methods in my Document
> object that pass the real action through to the SourveView since the
> Document object always is part of the Responder Chain.

 That’s what I usually do. Alternately, if I have a view controller for the 
source view, I use setNextResponder: to insert the view controller in the 
responder chain somewhere farther up.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Creating NSButton in Code does not set controlTint to currentControlTint

2013-12-28 Thread Kyle Sluder
On Sat, Dec 28, 2013, at 06:05 AM, Uli Kusterer wrote:
>  Are you perhaps trying to implement “sticky” buttons? I.e. buttons that
>  toggle between on and off when clicked? These haven’t highlighted in
>  blue for a long time

No, they still highlight in blue (or gray if your control tint is
Graphite). Set showsStateBy to NSChangeBackgroundCellMask.

You can try out my ButtonTester tool to play with these flags in real
time: 

>  Maybe you want NSPushOnPushOff button,
>  which according to the docs highlights the button when pressed, too?

You'll note that if you do this (which is just a shortcut for setting
showsStateBy and highlightsBy), and your system's control tint is set to
Aqua, that the button will highlight in blue.

--Kyle Sluder

___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Trygve Inda
> 
> On 27 Dec 2013, at 13:52, Trygve Inda  wrote:
> 
>> I have a document with a SourceView on the left side (like iTunes). Some
>> main menu commands pertain to actions in the Source View. This works fine if
>> the SourceView is the active view but my window has other views held in a
>> SplitView.
>> 
>> If a sibling of the SourceView is active, the SourceView is not in the
>> responder chain and thus my menu commands are greyed out.
>> 
>> How can I keep a sibling view in the responder chain?
>> 
>> The alternative is I have to re-create "passthrough" methods in my Document
>> object that pass the real action through to the SourveView since the
>> Document object always is part of the Responder Chain.
> 
>  That’s what I usually do. Alternately, if I have a view controller for the
> source view, I use setNextResponder: to insert the view controller in the
> responder chain somewhere farther up.
> 
> Cheers,
> -- Uli Kusterer
> “The Witnesses of TeachText are everywhere...”
> http://zathras.de
> 
> 

Can you give an example of how you do that? I guess I'd want it right after
my document controller. Do I need to walk the list looking for my document
controller?

Or just do:

[[document windowController] setNextResponder:sourceViewController]

Trygve




___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

CFMessagePortCreateLocal() fails occasionally in 10.9?

2013-12-28 Thread Jerry Krinock
Last week I received a second error report from a Mavericks user, via my app’s 
built-in error reporter, indicating that CFMessagePortCreateLocal() returned 
NULL.  I have no record of this happening prior to Mavericks.  Both users 
report that the operations succeeded when they retried it.

Has anyone else noticed this, or have any knowledge of why it might be 
occurring?

To try and remedy it, I’ve now added a loop around my call to 
CFMessagePortCreateLocal() so that it will wait 1 second and retry, up to 5 
seconds.

My app normally runs with less than 200 ports open, and my code explicitly 
creates only a handful.  According to Activity Monitor, some apps (Apple’s 
MainStage 2) have thousands, as does launchd.  So I added some test code which 
created 10,000 ports.  It worked with no trouble.

Jerry


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CFMessagePortCreateLocal() fails occasionally in 10.9?

2013-12-28 Thread Kyle Sluder
On Sat, Dec 28, 2013, at 11:24 AM, Jerry Krinock wrote:
> Has anyone else noticed this, or have any knowledge of why it might be
> occurring?

One of the great things about Core Foundation is that it is open source:


Looks like there are three failure cases other than allocation failure.
Two of them should log a failure reason before returning NULL. Can you
ask the user for any proximate console logs?

--Kyle Sluder
___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Creating NSButton in Code does not set controlTint to currentControlTint

2013-12-28 Thread Peter Teeson
On 2013-12-28, at 11:43 AM, Kyle Sluder  wrote:
> You can try out my ButtonTester tool to play with these flags in real
> time: 
Wow you are definitely amazing. I had just started working on a project to do 
just that sort of thing.
You did it first (and surely better than I would have done.) I tip my hat to 
you and thanks.

respect…

Peter
___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSURLSession + Bonjour to do peer-to-peer file transfers?

2013-12-28 Thread Eric Wing
On 12/26/13, Jens Alfke  wrote:
>
> On Dec 25, 2013, at 7:26 AM, Eric Wing  wrote:
>
>> I can publish my iPhone via Bonjour and make my Mac discover and
>> resolve the address. I try to create a NSURLSessionDownloadTask on my
>> Mac and a NSURLSessionUploadTask on my iPhone.
>
> That won’t work, because both of those are acting as HTTP clients (one
> sending a GET, the other probably a PUT.) Unless one of them acts as a
> server instead, they can’t talk to each other.
>
> All Bonjour does is advertise the availability of a listener/server/service
> on a port. But it doesn’t actually _create_ that listener — that’s your
> responsibility. You have to run some kind of server code that will bind to
> that port, accept connections, and speak the desired protocol.
>
> The problem is, Apple doesn’t include any high-level APIs for running such a
> server. Most commonly people want to serve HTTP. You can cobble together a
> crude HTTP server using CFStream and CFHTTPMessage, but there are a lot of
> details involved in making one that will work for real (i.e. well enough to
> talk to a browser.) Or you could build a very simple custom protocol if all
> you need to do is transfer a blob of data.
>
> Take a look at Apple’s PictureSharing sample code, which shows how to set up
> a basic server and client to send data.
> If you want to run a real HTTP server, the best package I know of is
> CocoaHTTPServer (find it on Github.)
>
> —Jens

Thanks for the explanation Jens. I definitely misunderstood the notion
of "server" with http uploading (I thought NSURLSessionUploadTask
would be the server). This is partly why I couldn't seem to feed the
NSNetService addresses/ports into something useful for me.

Based on Stephen's reply, I had already found CocoaHTTPServer. After
several (very long) days, I have a prototype that works for me with
both NSURLSession clients and also Android/Java HttpURLConnection
based clients, all discoverable through Zeroconf.

This was a lot harder than I thought it would be though. I struggled
with lots of separate details, such as changing the CocoaHTTPServer's
file example which was a Content-Type "multipart" example into
something that uses "application/octet-stream" (which uploading a file
with NSURLSession seems to set), and then figuring out how to send the
same with HttpURLConnection and encountering things like fixed-length
vs chunked streaming mode. (I never did figure out how to send an EOF
when in chunked mode.) I was hoping both the Cocoa and Java frameworks
had advanced enough to the point where things like file serving was
trivial for a network dummy like myself, but I don't think they are
there yet. To their credit, I still managed to get something that
eventually worked, albeit with a lot more effort and ugly.

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Two problems trying to use NSTextView for a scrolling console/terminal like view

2013-12-28 Thread Eric Wing
I’ve been prototyping an internal tool that receives and displays lots
of text data. I wanted to display this kind of like how Terminal.app
continuously appends text and keeps scrolling to the bottom as more
data is added.

I used a stock NSTextView and keep appending to the backing NSTextStorage.
I found a solution to autoscrolling on stackoverflow which I incorporated.
http://stackoverflow.com/questions/15546808/scrolling-nstextview-to-bottom


- (void) postLogEvent:(NSString*)log_message
{
BOOL scroll = (NSMaxY([[self logStreamTextView] visibleRect]) ==
NSMaxY([[self logStreamTextView] bounds]));
self logStreamTextView] textStorage] mutableString]
appendString:log_message];
if (scroll) // Scroll to end of the textview contents
{
[[self logStreamTextView] scrollRangeToVisible: 
NSMakeRange([[[self
logStreamTextView] string] length], 0)];
}
}

This works, but I encountered two problems when the data set gets large.

1) Somewhere after 40,000 lines of text, the application starts
becoming unresponsive. Around 50k-60k, the application feels hung and
I have to force kill it. I figured out that the bottleneck was in
scrollRangeToVisible call.

I’ve posted 3 screenshots from Instruments here:
https://picasaweb.google.com/ewmailing/AutoscrollingNSTextViewTrace#5962576581630914370

2) If I disable autoscrolling, performance is fine. I got to around
150,000 lines without any problems. But at some point later (my test
runs for several hours so I usually leave it unattended and it can
generate a million lines, so I don’t know exactly when), Cocoa raised
an exception at:

-[NSBigMutableString replaceCharactersInRange:withString:]: nil argument
(Full exception trace is below for interest.)


So I was wondering if there were any better techniques to avoid my two
problems or how I should go about resolving them. Since this is an
internal tool to help something else, I'm looking for simple/quick
solutions, though for my own curiosity, I also do wonder what the
proper solution is.


Thanks,
Eric


An uncaught exception was raised
2013-12-28 07:41:50.304 Test262LogClient[44722:303] ***
-[NSBigMutableString replaceCharactersInRange:withString:]: nil
argument
2013-12-28 07:41:50.305 Test262LogClient[44722:303] (
0   CoreFoundation  0x7fff92d6e41c
__exceptionPreprocess + 172
1   libobjc.A.dylib 0x7fff8b7ebe75
objc_exception_throw + 43
2   CoreFoundation  0x7fff92d6e2cc
+[NSException raise:format:] + 204
3   Foundation  0x7fff928430e4
-[NSBigMutableString replaceCharactersInRange:withString:] + 111
4   Foundation  0x7fff9284185e
-[NSConcreteMutableAttributedString
replaceCharactersInRange:withString:] + 295
5   AppKit  0x7fff893ff136
-[NSConcreteTextStorage replaceCharactersInRange:withString:] + 77
6   Test262LogClient0x000120bf
-[LogStreamWindowController postLogEvent:] + 591
7   Test262LogClient0x000100010533
__69-[ResolveForLogStreamDelegate
connectToServerAndSendStreamDirective:]_block_invoke_256 + 67
8   libdispatch.dylib   0x7fff8c3e11d7
_dispatch_call_block_and_release + 12
9   libdispatch.dylib   0x7fff8c3de2ad
_dispatch_client_callout + 8
10  libdispatch.dylib   0x7fff8c3e5f03
_dispatch_main_queue_callback_4CF + 333
11  CoreFoundation  0x7fff92cd5839
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
12  CoreFoundation  0x7fff92c90b14
__CFRunLoopRun + 1636
13  CoreFoundation  0x7fff92c90275
CFRunLoopRunSpecific + 309
14  HIToolbox   0x7fff8b9baf0d
RunCurrentEventLoopInMode + 226
15  HIToolbox   0x7fff8b9bacb7
ReceiveNextEventCommon + 479
16  HIToolbox   0x7fff8b9baabc
_BlockUntilNextEventMatchingListInModeWithFilter + 65
17  AppKit  0x7fff891a228e 
_DPSNextEvent + 1434
18  AppKit  0x7fff891a18db
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
19  AppKit  0x7fff891959cc
-[NSApplication run] + 553
20  AppKit  0x7fff89180803
NSApplicationMain + 940
21  Test262LogClient0x00010005f962 main + 34
22  libdyld.dylib   0x7fff8d6245fd start + 1
23  ??? 0x0003 0x0 + 3
)
2013-12-28 07:41:50.307 Test262LogClient[44722:303] *** Terminating
app due to uncaught exception 'NSInvalidArgumentException', reason:
'*** -[NSBigMut

Re: NSTextTable with only certain text selectabled

2013-12-28 Thread Fritz Anderson
On 21 Nov 2013, at 10:55 AM, Andrew Arrow  wrote:

> How do I make a drag select on a NSTextView with an NSAttributedString
> that contains a 2 column NSTextTable, only select the text in the 1st
> column?
> 
> You can see a video of the mac app skype doing this here:
> 
> https://dl.dropboxusercontent.com/u/2510380/skype.mov

What leads you to believe that Skype is using the very specific technique you 
ask about? Did you point a debugger at it? Disassemble? From what I see in the 
animation, your guess looks very unlikely.

Assuming your actual goal is to select across disjoint text containers:

A quick examination of the API persuades me that the option isn't available in 
a single NSTextView. There's no royal road. I'm sure there's some way to do it 
in HTML/CSS/JavaScript, but I can't help you there.

What you can do is to divide the column into a series of NSTextViews. There is 
a text-storage (attributed string) with the full contents of the column. It is 
associated with one layout manager. Ask the layout manager for the height of 
each block of text you want to put on its own row, and initialize a container 
from it. Put each container into its own NSTextView.

See 

 (assuming Xcode documentation URLs work; it's Cocoa Text Architecture Guide > 
Text System Organization > Creating Text System Objects > Your App Creates the 
Objects Explicitly) Also TextSizingExample in the sample code.

My experiment shows that if you drag down from one text view to the next, the 
selection spans the views. There's no question of the selection spilling out to 
other views, because the text system never sees them.

This is the first thing that comes to mind, from WWDC ~2005. I haven't done 
this sort of thing in years, and I'm probably missing some technique the kids 
are using these days, with their bow ties and hipster music. I can imagine 
doing something by hit-testing the table drags and being clever with the 
setSelectedRange: family, but that's worse.

— F


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CFMessagePortCreateLocal() fails occasionally in 10.9?

2013-12-28 Thread Jerry Krinock

On 2013 Dec 28, at 12:14, Kyle Sluder  wrote:

> Can you ask the user for any proximate console logs?

Very good, Kyle!  Yes, indeed my app has a built-in "Trouble Zipper” feature 
and one of the things it does is to filter and zip console logs.  I just sent 
an email to the user requesting that he run it before the relevant log expires. 
 I’ll post back if I learn anything interesting.


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Two problems trying to use NSTextView for a scrolling console/terminal like view

2013-12-28 Thread Jerry Krinock

On 2013 Dec 28, at 15:14, Eric Wing  wrote:

> 1) I figured out that the bottleneck was in scrollRangeToVisible call.

You could see if you have better luck with -[NSView scrollPoint:].

> 2) -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument

Well, there’s the obvious answer that your other code is passing nil for 
withString:.  You could check for that.


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Uli Kusterer

On 28 Dec 2013, at 18:48, Trygve Inda  wrote:

>> 
>> On 27 Dec 2013, at 13:52, Trygve Inda  wrote:
>> 
>>> I have a document with a SourceView on the left side (like iTunes). Some
>>> main menu commands pertain to actions in the Source View. This works fine if
>>> the SourceView is the active view but my window has other views held in a
>>> SplitView.
>>> 
>>> If a sibling of the SourceView is active, the SourceView is not in the
>>> responder chain and thus my menu commands are greyed out.
>>> 
>>> How can I keep a sibling view in the responder chain?
>>> 
>>> The alternative is I have to re-create "passthrough" methods in my Document
>>> object that pass the real action through to the SourveView since the
>>> Document object always is part of the Responder Chain.
>> 
>> That’s what I usually do. Alternately, if I have a view controller for the
>> source view, I use setNextResponder: to insert the view controller in the
>> responder chain somewhere farther up.
>> 
>> Cheers,
>> -- Uli Kusterer
>> “The Witnesses of TeachText are everywhere...”
>> http://zathras.de
>> 
>> 
> 
> Can you give an example of how you do that? I guess I'd want it right after
> my document controller. Do I need to walk the list looking for my document
> controller?
> 
> Or just do:
> 
> [[document windowController] setNextResponder:sourceViewController]
> 
> Trygve

Well, you’ll also want to give the document a shot, so

sourceViewController.nextResponder = document.windowController.nextResponder;
document.windowController.nextResponder = sourceViewController;

That way you insert between the window controller and the document. For window 
controllers without a document, the next responder is usually the application, 
IIRC, so you don’t want to sever the chain. 

That said, the supplemental target thing someone else suggested sounds like a 
nice and clean way of doing it that I haven’t tried yet.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UISlider with custom images & narrow thumb

2013-12-28 Thread Fritz Anderson
On 21 Nov 2013, at 8:36 AM, John Spicer  wrote:

> I'm trying to get a UISlider working with custom images. I've gone through 
> the docs, and I know how to set the images.
> The question (and the problem) is a little different.
> 
> Our design department has given us a thumb image that is wide at the bottom, 
> and narrow at the top (1 pixel).
> 
> When I use this image, it does not line up properly with the current value of 
> the slider.

UISlider takes a UIImage as its thumb image. UIImage and UISlider do not care 
about the bit-by-bit drawable content of the image. All they know is that if 
you initialize a UIImage from a 24 x 24-point PNG, the image is 24 x 24 points 
in size. Is the drawn content 24 x 24 of black pixels? A circle, which is 
necessarily 24 points wide at the middle? 24 x 24 of transparent pixels? A 
black triangle that's half the pixel width at the middle?

Does not matter. The thumb image will be drawn so at the extremes of the 
slider, the image (not its drawn content) is flush against the end of the 
track. Run the experiment with two sliders, one with your image and the other 
with the default one, and you'll see they behave identically. They line up 
properly; they just don't line up as you'd hoped.

> All the examples I've seen on the net show a thumb that's fairly fat and 
> round – never one like I've been given.
> The docs don't SAY you have to use a fat one, but it seems implied.

And anyone who attempts anything else soon finds out. If you care, find the 
part of the documentation where you think the warning ought to go (maybe the 
Sliders section of UIKit User Interface Catalog), and click the feedback link.

> 
> So the question is: can I use a thumb like this, and if so, how do I get the 
> positioning of the narrow top of the image (center) to align with the current 
> value of the slider?

Your premise is incorrect. The thumb _is_ aligned with the current value of the 
slider. What surprises you is that you didn't know that UISlider does not draw 
the thumb outside the frame of the control, and that you assumed UISlider knew, 
in this particular case, what part of the thumb you find most significant.

If the track is the problem, use a house shape, or a diamond, or something else 
that takes the full width of the image at the middle. Or maybe you can do 
something with the track images like providing images that are transparent for 
as much of the track as you want to hide.

If you're trying to line up with tick marks in an adjacent view, place the 
marks to line up with the actual positioning of the thumb.

— F


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: DockTile sample code, Principal class is "DockTile" ?

2013-12-28 Thread Fritz Anderson
On 28 Nov 2013, at 5:13 PM, Eden  wrote:

>   In Apple's "DockTile" sample code there is a an app and a dock tile 
> plug-in.
> 
>   In the DockTilePlugIn-Info.plist, the "Principal class" is valued as 
> "DockTile", but there is no such class-- the class in the source code is 
> "DockTilePlugIn".
> 
>   Isn't that a mistake?  But the thing works anyway?  The name of the 
> bundle is "DockTile.docktileplugin", so... does "Principal class" really 
> refer to the name of the bundle? Regardless, I can change the name of the 
> finder file and it still works.
> 
>   In fact, I can delete the value for "Principal class" and it still 
> works... although I can't be sure the working version of something wasn't 
> cached somewhere...
> 
>   Probably a foolish question, but this is my first time with loadable 
> bundles, I just want to understand...

The setting in Info.plist is a bug. The reason it works is that when -[NSBundle 
principalClass] can't find a class from Info.plist, it falls back to "the first 
class loaded," as determined by the link order of the plugin. As the plugin 
consists of only one class, the fallback happens to be correct.

Documentation bug filed.

— F


___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Trygve Inda

>> Can you give an example of how you do that? I guess I'd want it right after
>> my document controller. Do I need to walk the list looking for my document
>> controller?
>> 
>> Or just do:
>> 
>> [[document windowController] setNextResponder:sourceViewController]
>> 
>> Trygve
> 
> Well, you’ll also want to give the document a shot, so
> 
> sourceViewController.nextResponder = document.windowController.nextResponder;
> document.windowController.nextResponder = sourceViewController;
> 
> That way you insert between the window controller and the document. For window
> controllers without a document, the next responder is usually the application,
> IIRC, so you don’t want to sever the chain.
> 
> That said, the supplemental target thing someone else suggested sounds like a
> nice and clean way of doing it that I haven’t tried yet.

That would require 10.7 and I am not sure if I am ready to stop supporting
10.6 yet.

Trygve






___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Quincey Morris
On Dec 28, 2013, at 20:47 , Trygve Inda  wrote:

> That would require 10.7 and I am not sure if I am ready to stop supporting
> 10.6 yet.

What’s wrong with the even more straightforward approach of implementing each 
action method in an object that’s going to be in the responder chain at the 
correct time? You mentioned this in your original post, but didn’t really seem 
to take it seriously. It’s not more “correct” to implement actions in a view. 
AFAIK it’s just as correct to implement actions in controllers instead of 
views. The only real difference is that for views that are intended to be 
reusable in various kinds of windows (for example NSTextField or NSTextView), 
it’s a “packaging” convenience for the view to contain all its actions.

Assuming that the action really is something that the view needs to process 
(because it refers to state internal to the view), then I don’t see a problem 
in implementing the action in the view and implementing a same-named action 
method in the window controller, document or app delegate, and calling the 
view’s implementation.

If the action doesn’t need the view’s internal state (even if it does something 
to the view through its public interface), then I don’t see a problem in 
putting *the* action method in the window controller or document or app 
delegate. It can call non-action methods in the view as necessary.

Under these circumstance you would, of course, need to do the menu validation 
in the object that’s originally receiving the view, and you would set the 
target to First Responder in IB.

This is far easier than mucking about with the responder chain.

A couple of other points:

— It’s perhaps more logical to implement a menu action at a higher level than 
the view, if the action *only* originates from menus. My reasoning is that 
otherwise you’ve built knowledge of the menus into the view (the view contains 
actions “for” the menus, in a sense), which is somewhat of a MVC violation, or 
at least a smell. (Of course, many standard views and controls do it anyway.)

— For some actions which can be done either from a menu or from a control in a 
window, you may want the menu action to be slightly different, for user 
feedback reasons. For example, if you have a button in the window that performs 
some action, you may want the menu version to do a ‘performClick:’ on the 
button, instead of invoking the view’s action method directly, so that the user 
sees feedback that the menu is doing what the button would do.

___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Two problems trying to use NSTextView for a scrolling console/terminal like view

2013-12-28 Thread Eric Wing
On 12/28/13, Jerry Krinock  wrote:
>
> On 2013 Dec 28, at 15:14, Eric Wing  wrote:
>
>> 1) I figured out that the bottleneck was in scrollRangeToVisible call.
>
> You could see if you have better luck with -[NSView scrollPoint:].
>
>> 2) -[NSBigMutableString replaceCharactersInRange:withString:]: nil
>> argument
>
> Well, there’s the obvious answer that your other code is passing nil for
> withString:.  You could check for that.
>

Thanks Jerry. You were spot on with both answers. scrollPoint is a lot
faster and can handle the large data sets (though it is not as
accurate, but I don't care).

And I was indeed passing nil. The end of my data run contained funny
characters or null characters in the byte stream so my NSString
initWithBytes:length: encoding:NSUTF8StringEncoding was failing
despite giving a length. I had wrongly assumed I was hitting some size
limit in this case since my test had run fine for the first hour and
it was painful to retest since this takes a few hours.

But I did notice a new problem. At around 800,000 lines, the
NSTextView stops displaying new appended text. Strangely, if I do a
Cmd-A, Cmd-C, and then paste to another program, I do get all the
data. So the data exists, but it NSTextView is not displaying it
correctly. I'll chalk this up to a OS X bug and move on though.


Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Two problems trying to use NSTextView for a scrolling console/terminal like view

2013-12-28 Thread Jens Alfke

On Dec 28, 2013, at 10:11 PM, Eric Wing  wrote:

> But I did notice a new problem. At around 800,000 lines, the
> NSTextView stops displaying new appended text.

The Cocoa text system really doesn’t scale well to such huge amounts of text. 
The only apps I know of that can handle really large amounts, use custom text 
engines. (Terminal, for instance.)

If you just need read-only text without soft wrap, it’s not terribly hard to 
build your own text display engine. (There might even be an open source one?)

—Jens
___

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 your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com