Re: Detect shift key down

2011-06-26 Thread Bernard Desgraupes


Le 26 juin 11 à 07:22, Richard Somers a écrit :


On Jun 24, 2011, at 1:19 AM, Bernard Desgraupes wrote:

I need to detect if the shift key is pressed by the user during the  
startup of my app. How would I do that in Cocoa (targetting 10.5  
and greater) ?


Try this.


http://www.cocoabuilder.com/archive/cocoa/284356-alternative-startup-for-application.html


Thank you, this link is very helpful. The CGEventSourceKeyState  
solution works perfectly.




Le 26 juin 11 à 07:18, Ken Heglund a écrit :



This is how I do it in the application delegate's  
applicationDidFinishLaunching: implementation...


UInt32  modifiers = GetCurrentKeyModifiers();
if ( modifiers  shiftKey ) {
// handle shift key...
}


Thank you for the suggestion. In fact I'm entirely rewriting my Carbon  
app from scratch using Cocoa: GetCurrentKeyModifiers() is what I was  
doing previously. I was looking for a Cocoa solution.



Thanks to everybody,
cheers,
Bernard___

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

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


Caching Streaming video

2011-06-26 Thread Nathan Day
I am trying to playback video in my iOS app while I am loading and caching it 
at the same time. I fetch the video using a NSURLConnection and then store it 
in a local file, I start video playback of the local video file after a certain 
number of bytes are received. I have it working great in the simulator, I can 
start playing the video before I have received all of it, but when I go to run 
my app on my iPodTouch, I can only seem to play up to the number of bytes I had 
already received before I started playback. I can only play the entire video if 
I wait until I have receive the entire file before I start playback. I can also 
get the video to play completely if I stop the failed attempt with a [video 
stop] message and then start playing it again, pausing the video only doesn't 
work.

Has anybody got this working, is it possible.


Nathan Day
Software Engineer
mobile: +61 (0)4 3863 2407
home page:  http://homepage.mac.com/nathan_day/







___

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

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


Re: Cocoa scripting: targeting an app via its bundle identifier

2011-06-26 Thread Bill Cheeseman

On Jun 25, 2011, at 7:52 PM, Andy Lee wrote:

 get application id com.yourcompany.TrivialScriptable
 set myApp to result
 tell myApp


It has been true since the beginning of time (1993) that you cannot 'tell' a 
variable but must instead 'tell' the application, at least in most cases. It's 
one of the reasons why us old timers think of AppleScript as a trial and 
error language. You have to learn many of the rules by doing, not by reading 
the manual.

I wrote this particular issue up at length many years ago in two old articles 
that are still available on The AppleScript Sourcebook at 
http://macscripter.net/viewtopic.php?id=24570 and 
http://macscripter.net/viewtopic.php?id=24569. Some of what I wrote then is 
no longer completely true, thanks to the ongoing evolution of AppleScript.

-- 

Bill Cheeseman - b...@cheeseman.name

___

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

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


Re: [ANN] CoreParse

2011-06-26 Thread Thomas Davie

On 6 Jun 2011, at 16:10, Philip Mötteli wrote:

 I really appreciate how BN support is implemented in ParseKit: 
 http://parsekit.com/grammars.html. I like it very much, that there are no 
 numbers, but call backs for every token, using method-names (c. f. above URL 
 under Instantiating Grammar Parsers in Objective-C).

Hi Philip,

I thought you'd like to know I've improved the handling of BN grammars in 
CoreParse significantly.  You can read about how it works at 
https://github.com/beelsebob/CoreParse.

Thanks

Tom Davie___

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

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


Re: NSBrowser matrix

2011-06-26 Thread Fritz Anderson

On 25 Jun 2011, at 7:05 PM, Ari Black wrote:

 @implementation SpecialMatrix
 
 - (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode 
 prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows 
 numberOfColumns:(NSInteger)numColumns {
int x;
x = 0; // I put a breakpoint here
 
return self;
 }
 
 @end

You don't get to this point, so it's not the problem you have now, but I assume 
your real code invokes [super initWithFrame:...]?

 This is in the implementation of the class that controls  the window the 
 browser is in:
 
 - (void)awakeFromNib {
[browser setMatrixClass:[SpecialMatrix class]];
 
[browser loadColumnZero];
 
NSMatrix *matrix = [storyLine matrixInColumn:0];  // - return nil
matrix = [storyLine matrixInColumn:1]; // - returns nil
 }

First step: Break in -awakeFromNib and verify that browser is not nil.

Second step: Maybe an NSBrowser doesn't instantiate any matrices until you have 
responded to browser:numberOfRowsInColumn: with a non-zero value?

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

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


Re: NSBrowser matrix

2011-06-26 Thread Fritz Anderson
On 26 Jun 2011, at 6:18 AM, Ari Black wrote:

 Second step: Maybe an NSBrowser doesn't instantiate any matrices until you 
 have responded to browser:numberOfRowsInColumn: with a non-zero value?
 
  — F
 
 That's possible, but I've tested adding items to the columns and 
 SpecialMatrix's initWith...: doesn't get called.
 
 I do want to point out that I'm implementing
 browser:numberOfChildrenOfItem: not browser:numberOfRowsInColumn, does that 
 make a difference?

Yes. The first returns the number of rows in column n+1, given an item in 
column n. The second returns whether there are any items in column n at all.

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

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


Re: Cocoa scripting: targeting an app via its bundle identifier

2011-06-26 Thread Andy Lee
On Jun 26, 2011, at 6:09 AM, Bill Cheeseman wrote:
 
 On Jun 25, 2011, at 7:52 PM, Andy Lee wrote:
 
 get application id com.yourcompany.TrivialScriptable
 set myApp to result
 tell myApp
 
 
 It has been true since the beginning of time (1993) that you cannot 'tell' a 
 variable but must instead 'tell' the application, at least in most cases. 
 It's one of the reasons why us old timers think of AppleScript as a trial 
 and error language. You have to learn many of the rules by doing, not by 
 reading the manual.

I gathered as much from the Scope of This Book chapter of Matt Neuburg's book.

 I wrote this particular issue up at length many years ago in two old articles 
 that are still available on The AppleScript Sourcebook at 
 http://macscripter.net/viewtopic.php?id=24570 and 
 http://macscripter.net/viewtopic.php?id=24569. Some of what I wrote then is 
 no longer completely true, thanks to the ongoing evolution of AppleScript.

I almost stumbled across the double-tell technique. In one of my iterations I 
used the bundle id to activate the app, then used the name in a separate tell 
block to send my custom command. It didn't occur to me to nest the tells.

The double-tell reminds me of casting an Objective-C variable to get rid of a 
compiler warning, when you know that the method you're calling will be found at 
runtime. The compiler warning in AppleScript is when you save or run the 
script and a command name doesn't turn bold.

Thanks, Bill!

--Andy

___

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

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


Re: DO independentConversationQueueing, invocation from callback

2011-06-26 Thread Dave Keck
I wrote a small test case that exhibits the problem:

http://pastie.org/2124066

It can be compiled and run like this:

killall -KILL dotest; gcc -framework Foundation dotest.m -o dotest; ./dotest

When independentConversationQueueing is disabled (see EnableICQ()),
ProcessC receives the -doSomething message, but when ICQ is enabled,
it does not.

Radar forthcoming...
___

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

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


Re: Animating handwriting

2011-06-26 Thread Gustavo Pizano
Ok I will check in Photoshop and create the animation there.

Thanks all for the reply
G
On Jun 25, 2011, at 4:47 AM, Scott Anguish wrote:

 I don’t think it’s the amount of page space, rather the quantity of the 
 alphabet.
 
 If this is just for an effect for an about screen or soemthing, I’d say your 
 photoshop idea is the way to go.
 
 Otherwise, I’d suggest the drawing custom app, but even then you’re going to 
 have issues with making sure that as you put in the ‘lines’ to follow for the 
 pen that the direction of the animated fill is right (likely at 90 degrees to 
 the pen position or previous direction). I only know this because it’s an 
 issue with embroidery software. the alternative is to draw points back and 
 forth on each side of the each letter for the fill. major tedium.
 
 All this sounds like a lot of work without knowing what the reason is.
 
 
 On Jun 24, 2011, at 9:26 AM, Ken Tozier wrote:
 
 If you're writing a whole page of text, creating all the frames by hand 
 would get real old real quick.
 

___

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

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


Re-using the same NIB on two owners

2011-06-26 Thread Daniel Luis dos Santos
Hello,

I have an application that has two windows. Each window is associated to a 
controller class. On one method of each class I load another NIB that has a 
subordinate window. That subordinate NIB has outlets and actions that should be 
associated to the loading class, so on the NIB I set the File's Owner to be of 
the class that loads it.

My problem is that I need to load the same NIB from two different classes, so 
the owner is different according to which class I load it from.
Is there another way to do it without the file's owner ? Subclassing the 
controller ?

Thanks for replying___

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

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


Re: Re-using the same NIB on two owners

2011-06-26 Thread Sherm Pendley
On Sun, Jun 26, 2011 at 11:16 AM, Daniel Luis dos Santos
daniel.d...@gmail.com wrote:

 My problem is that I need to load the same NIB from two different classes, so 
 the owner is different according to which class I load it from.
 Is there another way to do it without the file's owner ? Subclassing the 
 controller ?

One way would be to declare a common superclass, of which both owner
classes are subclasses, that implements the outlets  actions that are
connected in the .xib. Each subclass can then override the actions as
needed. In IB (or Xcode 4, as the case may be), just define the
file's owner in the .xib as the parent class.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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

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


NSURLConnection

2011-06-26 Thread R
Any opinions on which approach is better.


NSData *data = [NSURLConnection sendSynchronousRequest:request

 returningResponse:response

 error:error];

OR

connectionInProgress=[[NSURLConnection alloc]initWithRequest:request

delegate:self

startImmediately:YES];
}


- (void)connection:(NSURLConnection *)connection didReceiveData:
(NSData *)data{
}

- (void)connection:(NSURLConnection *)connection didFailWithError:
(NSError *)error{
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
}
___

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

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


Re: NSURLConnection

2011-06-26 Thread Fritz Anderson
On 26 Jun 2011, at 11:37 AM, R wrote:

 Any opinions on which approach is better.
 
 NSData *data = [NSURLConnection sendSynchronousRequest:request
   returningResponse:response
   error:error];
 
 OR
 
 connectionInProgress=[[NSURLConnection alloc]initWithRequest:request
   delegate:self
   startImmediately:YES];
 }
...

Synchronous network operations are almost always a bad idea. You can't cancel 
them, you can't process the returned data on-the-fly, there's no way to provide 
credentials dynamically, and if you run them on your main thread, you lock up 
your human interface.

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

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


Re: NSURLConnection

2011-06-26 Thread Gary L. Wade
The asynchronous option allows you to report progress and utilize your data 
immediately and do with it whatever you wish while the synchronous option 
requires you wait until the entire data has been retrieved, possibly an issue 
if you have data of any size. Also, for UI responsiveness, the synchronous 
option really only makes sense on a secondary thread while the asynchronous 
option can be fully performed on the main thread.

- Gary L. Wade (Sent from my iPhone)

On Jun 26, 2011, at 9:37 AM, R r4eem...@gmail.com wrote:

 Any opinions on which approach is better.
 
 
 NSData *data = [NSURLConnection sendSynchronousRequest:request
 returningResponse:response
 error:error];
 
 OR
 
 connectionInProgress=[[NSURLConnection alloc]initWithRequest:request
delegate:self
startImmediately:YES];
 }
 
 
 - (void)connection:(NSURLConnection *)connection didReceiveData:
 (NSData *)data{
 }
 
 - (void)connection:(NSURLConnection *)connection didFailWithError:
 (NSError *)error{
 }
 
 - (void)connectionDidFinishLoading:(NSURLConnection *)connection{
 }
___

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

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


Problem with setNeedsLayout and layoutSubviews in UIScrollView

2011-06-26 Thread Tales Pinheiro de Andrade
Hi.

I have a few custom views of three kind inside a custom UIScrollview. I'm 
trying to resize these custom views as the device change the orientation.

I added these custom views programatically to the custom UIScrollView. I 
implemented in the custom UIScrollview the below method

- (void)layoutSubviews {
UIDeviceOrientation currentOrientation =  [[UIDevice currentDevice] 
orientation];
if (UIDeviceOrientationIsLandscape(currentOrientation)) {
for (id view in [self subviews]) {
if ([view isKindOfClass:[ECIndexComponent class]] ||
[view isKindOfClass:[ECListComponent class]] ||
[view isKindOfClass:[ECGraphView class]]) {

CGRect newFrame = [(UIView *)view frame];
newFrame.size.width *= 1.5;
newFrame.size.height *= 1.5;
newFrame.origin.y *= 1.5;
[(UIView *)view setFrame:newFrame];
}
}
}
else {
for (id view in [self subviews]) {
if ([view isKindOfClass:[ECIndexComponent class]] ||
[view isKindOfClass:[ECListComponent class]] ||
[view isKindOfClass:[ECGraphView class]]) {
CGRect newFrame = [(UIView *)view frame];
newFrame.size.width *= 0.666;
newFrame.size.height *= 0.666;
newFrame.origin.y *= 0.666;
[(UIView *)view setFrame:newFrame];
}
}

}
}

And in my view controller shouldAutorotateToInterfaceOrientation method I call 
setNeedsLayout for the custom scroll view. It's almost there, but now, when I 
try to scroll, these subviews get redimensioned, even if I did not changed the 
orientation. It looks like the scrolling is calling layoutSubviews

Is there a way to correct this?

Thank you
___

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

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


Re: Problem with setNeedsLayout and layoutSubviews in UIScrollView

2011-06-26 Thread David Duncan
Yes, scroll views layout during scroll. But the reSl problem is likely in your 
use of device orientation. Specifically unlike interface orientation, not being 
landscape is not the same ad bring portrait, as device orientation has 3 
additional orientations. If you want to match your interface orientation, us 
the interfaceOrientation property on your view controller. 

That said, why layout that way at all? Why not base your layout on the views 
bounds instead?

--
David Duncan @ My iPhone

On Jun 26, 2011, at 11:39 AM, Tales Pinheiro de Andrade tal...@me.com wrote:

 Hi.
 
 I have a few custom views of three kind inside a custom UIScrollview. I'm 
 trying to resize these custom views as the device change the orientation.
 
 I added these custom views programatically to the custom UIScrollView. I 
 implemented in the custom UIScrollview the below method
 
 - (void)layoutSubviews {
UIDeviceOrientation currentOrientation =  [[UIDevice currentDevice] 
 orientation];
if (UIDeviceOrientationIsLandscape(currentOrientation)) {
for (id view in [self subviews]) {
if ([view isKindOfClass:[ECIndexComponent class]] ||
[view isKindOfClass:[ECListComponent class]] ||
[view isKindOfClass:[ECGraphView class]]) {
 
CGRect newFrame = [(UIView *)view frame];
newFrame.size.width *= 1.5;
newFrame.size.height *= 1.5;
newFrame.origin.y *= 1.5;
[(UIView *)view setFrame:newFrame];
}
}
}
else {
for (id view in [self subviews]) {
if ([view isKindOfClass:[ECIndexComponent class]] ||
[view isKindOfClass:[ECListComponent class]] ||
[view isKindOfClass:[ECGraphView class]]) {
CGRect newFrame = [(UIView *)view frame];
newFrame.size.width *= 0.666;
newFrame.size.height *= 0.666;
newFrame.origin.y *= 0.666;
[(UIView *)view setFrame:newFrame];
}
}
 
}
 }
 
 And in my view controller shouldAutorotateToInterfaceOrientation method I 
 call setNeedsLayout for the custom scroll view. It's almost there, but now, 
 when I try to scroll, these subviews get redimensioned, even if I did not 
 changed the orientation. It looks like the scrolling is calling layoutSubviews
 
 Is there a way to correct this?
 
 Thank you
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
 
 This email sent to david.dun...@apple.com
___

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

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


Re: Problem with setNeedsLayout and layoutSubviews in UIScrollView

2011-06-26 Thread Tales Pinheiro de Andrade
Well, I used the macro UIDeviceOrientationIsLandscape, I'm assuming that this 
is for both sides:
#define UIDeviceOrientationIsPortrait(orientation)  ((orientation) == 
UIDeviceOrientationPortrait || (orientation) == 
UIDeviceOrientationPortraitUpsideDown)
#define UIDeviceOrientationIsLandscape(orientation) ((orientation) == 
UIDeviceOrientationLandscapeLeft || (orientation) == 
UIDeviceOrientationLandscapeRight)

So the else only occours when the device is in portrait (being normal or upside 
down), right?

So, if scroll view layout during scroll, I cannot do this resizing in 
layoutSubview, and should do this in shouldAutorotateToInterfaceOrientation 
method in my controller?

Em 26/06/2011, às 16:07, David Duncan escreveu:

 Yes, scroll views layout during scroll. But the reSl problem is likely in 
 your use of device orientation. Specifically unlike interface orientation, 
 not being landscape is not the same ad bring portrait, as device orientation 
 has 3 additional orientations. If you want to match your interface 
 orientation, us the interfaceOrientation property on your view controller. 
 
 That said, why layout that way at all? Why not base your layout on the views 
 bounds instead?
 
 --
 David Duncan @ My iPhone
 
 On Jun 26, 2011, at 11:39 AM, Tales Pinheiro de Andrade tal...@me.com wrote:
 
 Hi.
 
 I have a few custom views of three kind inside a custom UIScrollview. I'm 
 trying to resize these custom views as the device change the orientation.
 
 I added these custom views programatically to the custom UIScrollView. I 
 implemented in the custom UIScrollview the below method
 
 - (void)layoutSubviews {
   UIDeviceOrientation currentOrientation =  [[UIDevice currentDevice] 
 orientation];
   if (UIDeviceOrientationIsLandscape(currentOrientation)) {
   for (id view in [self subviews]) {
   if ([view isKindOfClass:[ECIndexComponent class]] ||

___

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

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


Masking UIImages (yes, again)

2011-06-26 Thread James Miller
I've been reading and experimenting and browsing and reading and experimenting 
but mostly failing miserably here and I need to ask the hive mind for some 
assistance.

In a nutshell, I'm just trying to take a range of white colors out of a UIImage 
and make those colors transparent. From what I've read, I shouldn't use PNGs 
with an alpha already defined, but I also shouldn't use JPGs because they don't 
have an alpha channel.

So I've been trying to the extract the UIImage's CGImage and then convert it 
from RGB to RGBA and THEN mask it with CGImageCreateWithMaskingColors with no 
success (transparent areas appear as black). I've tried various techniques 
involving CGBitmapContextCreate and CGImageCreate but with no luck.

This can't POSSIBLY be as complicated as I'm making this out to be! Can someone 
please show me how to do this properly!?

A thousand thank yous and a pet herring named after you!

--James




The world is divided into people who do things and people who get the credit. 
Try, if you can, to belong to the first class. There's far less competition.

___

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

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


Re: Masking UIImages (yes, again)

2011-06-26 Thread Luke Hiesterman


On Jun 26, 2011, at 3:06 PM, James Miller jmiller3...@gmail.com wrote:

 I've been reading and experimenting and browsing and reading and 
 experimenting but mostly failing miserably here and I need to ask the hive 
 mind for some assistance.
 
 In a nutshell, I'm just trying to take a range of white colors out of a 
 UIImage and make those colors transparent. From what I've read, I shouldn't 
 use PNGs with an alpha already defined, but I also shouldn't use JPGs because 
 they don't have an alpha channel.

Where did you read that you shouldn't use PNGs with alpha?

 
 So I've been trying to the extract the UIImage's CGImage and then convert it 
 from RGB to RGBA and THEN mask it with CGImageCreateWithMaskingColors with no 
 success (transparent areas appear as black). I've tried various techniques 
 involving CGBitmapContextCreate and CGImageCreate but with no luck.

Note that if you did successfully make parts of your image transparent, they 
would show up as black if drawn into an opaque context. How are you 
drawing/displaying the image?

Luke

 
 This can't POSSIBLY be as complicated as I'm making this out to be! Can 
 someone please show me how to do this properly!?
 
 A thousand thank yous and a pet herring named after you!
 
 --James
 
 
 
 
 The world is divided into people who do things and people who get the 
 credit. Try, if you can, to belong to the first class. There's far less 
 competition.
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
 
 This email sent to luket...@apple.com
___

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

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


MFMailComposeViewController: referencing attached data in HTML body

2011-06-26 Thread Pierre Fournier

Hi,is there a way to reference the attached data within the HTML 
body?[mailController addAttachmentData:pngDataFooter  mimeType:@image/png 
fileName:@footer.png];[mailController setMessageBody:@htmlbodyimg 
src=\footer.png\/body/html isHTML:TRUE];When running such code, I get a 
blue question mark instead of the image, while the image is correctly 
attached.I want to kind of compose an html email based of different images. 
 
___

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

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


network volume names changing etc.

2011-06-26 Thread Chris Idou
I've noticed that Mac OS sometimes silently changes the UNIX mount name of 
network volumes. For example, if I mount a network volume of Media, it would 
normally be /Volumes/Media, but sometimes it isn't. For example, if another 
user 
on the same machine mounts Media first, then you might end up having it mounted 
as /Volumes/Media-1 or some such.

Is there any document that discusses it? And what is the recommended way to 
store paths in this case? I don't know if its right, but I'm in the habit of 
storing UNIX paths, but this doesn't work very well for network shares because 
the UNIX path keeps changing because of the above. How can I store a path and 
get it back in a way that takes into account the above?

Also as an aside, is there a way to have network volumes mounted for all users 
at once instead of just one user at a time?

___

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

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


Re: network volume names changing etc.

2011-06-26 Thread Ken Thomases
On Jun 26, 2011, at 8:08 PM, Chris Idou wrote:

 I've noticed that Mac OS sometimes silently changes the UNIX mount name of 
 network volumes. For example, if I mount a network volume of Media, it would 
 normally be /Volumes/Media, but sometimes it isn't. For example, if another 
 user 
 on the same machine mounts Media first, then you might end up having it 
 mounted 
 as /Volumes/Media-1 or some such.
 
 Is there any document that discusses it? And what is the recommended way to 
 store paths in this case? I don't know if its right, but I'm in the habit of 
 storing UNIX paths, but this doesn't work very well for network shares 
 because 
 the UNIX path keeps changing because of the above. How can I store a path and 
 get it back in a way that takes into account the above?

Best practice is to not store paths, but to store NSURL/CFURL bookmark data or, 
prior to 10.6, alias records.  Whether or not those will work in the face of 
the volume path changes you note, I don't know, but they are probably your best 
bet.  An alternative, just for network mounted volumes, would be to get the 
volume URL using FSCopyURLForVolume.  (For local volumes, the URL is roughly 
equivalent to the file path and provides no additional information.)

 Also as an aside, is there a way to have network volumes mounted for all 
 users 
 at once instead of just one user at a time?

I don't recall the specifics, but I believe so if the volume is mounted at boot 
rather than during a user session.  You can use fstab or the automount/autofs 
system to achieve this.

Regards,
Ken

___

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

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


Re: MFMailComposeViewController: referencing attached data in HTML body

2011-06-26 Thread Heath Borders
You could base64 your image data and use a data url to refer to it
within your HTML. Then, you wouldn't have to attach it.


-Heath Borders
heath.bord...@gmail.com
Twitter: heathborders
http://heath-tech.blogspot.com



On Sun, Jun 26, 2011 at 6:14 PM, Pierre Fournier shir...@hotmail.com wrote:

 Hi,is there a way to reference the attached data within the HTML 
 body?[mailController addAttachmentData:pngDataFooter  mimeType:@image/png 
 fileName:@footer.png];[mailController setMessageBody:@htmlbodyimg 
 src=\footer.png\/body/html isHTML:TRUE];When running such code, I get 
 a blue question mark instead of the image, while the image is correctly 
 attached.I want to kind of compose an html email based of different images.   
                                        
 ___

 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:
 http://lists.apple.com/mailman/options/cocoa-dev/heath.borders%40gmail.com

 This email sent to heath.bord...@gmail.com

___

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

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


Re: NSBrowser matrix

2011-06-26 Thread Ari Black

On 11-06-26 7:04 AM, Fritz Anderson wrote:


On 25 Jun 2011, at 7:05 PM, Ari Black wrote:


@implementation SpecialMatrix

- (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode 
prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows 
numberOfColumns:(NSInteger)numColumns {
int x;
x = 0; // I put a breakpoint here

return self;
}

@end


You don't get to this point, so it's not the problem you have now, but I assume 
your real code invokes [super initWithFrame:...]?


I hadn't put a call to [super ...] yet as I wanted to verify that my 
initWithFrame: was being called. Once I get this problem worked out, I 
will call [super ...].





This is in the implementation of the class that controls  the window the 
browser is in:

- (void)awakeFromNib {
[browser setMatrixClass:[SpecialMatrix class]];

[browser loadColumnZero];

NSMatrix *matrix = [storyLine matrixInColumn:0];  //- return nil
matrix = [storyLine matrixInColumn:1]; //- returns nil
}


First step: Break in -awakeFromNib and verify that browser is not nil.


I've tested this and it's not nil. browser is an outlet I created and 
connected with IB. The NSBrowser works for adding items to all of the 
columns and I check to make sure that SpecialMatrix is set to be the 
matrix class in browser after the call to setMatrixClass:




Second step: Maybe an NSBrowser doesn't instantiate any matrices until you have 
responded to browser:numberOfRowsInColumn: with a non-zero value?

— F


That's possible, but I've tested adding items to the columns and 
SpecialMatrix's initWith...: doesn't get called.


I do want to point out that I'm implementing
browser:numberOfChildrenOfItem: not browser:numberOfRowsInColumn, does 
that make a difference?


  Thanks!
___

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

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


Re: NSURLConnection

2011-06-26 Thread Jerry Krinock

On 2011 Jun 26, at 09:52, Fritz Anderson wrote:

 Synchronous network operations are almost always a bad idea. …, …, …, …,

and the error object that you get from 
-sendSynchronousRequest:returningResponse:error: if it fails is quite 
nondescript.

___

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

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


Re: NSURLConnection

2011-06-26 Thread Tito Ciuro
Hello,

If you have access to the Developer Forums, check the very first entry in Core 
OS named Five Reasons Why Synchronous Networking Is Bad, by Apple's Quinn 
The Eskimo!:

https://devforums.apple.com/thread/9606?tstart=0

Cheers,

-- Tito

On Jun 26, 2011, at 9:51 PM, Jerry Krinock wrote:

 
 On 2011 Jun 26, at 09:52, Fritz Anderson wrote:
 
 Synchronous network operations are almost always a bad idea. …, …, …, …,
 
 and the error object that you get from 
 -sendSynchronousRequest:returningResponse:error: if it fails is quite 
 nondescript.
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/tciuro%40mac.com
 
 This email sent to tci...@mac.com

___

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

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