Re: NSTask and setuid [SOLVED]

2009-03-13 Thread Mudi Dandan
It turned out that I set the setuid bit on different file from the one  
I launched with NSTask.

This  took me about 3 hours to realize, sorry :)

On Mar 14, 2009, at 2:24 AM, Mudi Dandan wrote:


Hi All,

I'm developing a setuid tool for my application and seems that   
NSTask doesn't respect the setuid bit and the effective uid remains  
501. However when launching the tool from the terminal the effective  
uid is 0 as expected.

What am i missing?

Mudi
___

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/mudi%40binarynights.com

This email sent to m...@binarynights.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


NSTask and setuid

2009-03-13 Thread Mudi Dandan

Hi All,

I'm developing a setuid tool for my application and seems that  NSTask  
doesn't respect the setuid bit and the effective uid remains 501.  
However when launching the tool from the terminal the effective uid is  
0 as expected.

What am i missing?

Mudi
___

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: Design Advice - Bread Crumbs, NSPathControl

2009-01-06 Thread Mudi Dandan

Hi Rob,

Yes, you can do it by subclassing NSPathControl  and providing a  
custom NSPathComponentCell.
I have done it that way too, see the result here: http://www.binarynights.com/blog/wp-content/uploads/picture-9.png 
.


Though the height cannot be set from IB you can change it runtime  
calling setframe:.


Mudi


On Jan 4, 2009, at 3:34 PM, Rob Evans wrote:


Folks,

I'd like to include a "Bread Crumbs" control in my application and
wonder if extending NSPathControl would be appropriate. I'd like my
control to look something like what you see in Apple's Instruments [1]
or WebKits WebInspector [2]. Since these are path like structures, I
naturally thought I should subclass NSPathControl and provide my own
NSPathComponentCell to get the specific look I'm after.

I've written some code that seems to work but my NSPathControl
subclass, when drawn, isn't as tall as I'd like it to be.

Am I on the right track? Can the height of an NSPathControl be,
well... controlled.

[1] http://lpetr.org/blog/wp-content/uploads/2007/06/safari_webinspector1.png
[2] 
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/instruments_window.jpg
___

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/mudi%40binarynights.com

This email sent to m...@binarynights.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: should it crash?

2008-12-28 Thread Mudi Dandan




On 29 Dec 2008, at 12:08 pm, Mudi Dandan wrote:

This is a overwriting confirmation dialog for file copying (very  
much like Finder's) and I'm releasing the view because it's not  
needed anymore after the user has chosen.



Terminology matters. By 'view' do you mean panel/window? I took  
'view' to mean an NSView, i.e. the button.




Sorry for the confusion.
Actually it's NSViewController with a view (this view has the buttons  
on it)  which I call panel/view inconsistently.
When user confirmation needed I create a NSViewController and add it's  
view to a window and display it to the user.




8. remove and release panel


Here I should have written "remove the NSView from the window and  
release it's NSViewcontroller"








9. ??? Update the button and crash



Why are these steps in this order? In fact why do you even need to  
update the button at this point at all - its window has gone. When  
the window is released it releases all its subviews, including the  
button.


Just leave out step 9.




Update is done by the system not by me. I guess it just want to redraw  
the button after the event.
I learned that if do step 7. in the button's action handler everything  
works fine.


Here is a stacktrace:

*** -[NSButton drawCell:]: message sent to deallocated instance 0x5cd5f0
..
..
..
#0  0x95ddc907 in ___forwarding___ ()
#1  0x95ddca12 in __forwarding_prep_0___ ()
#2  0x9604eae6 in -[NSButtonCell performClick:] ()
#3  0x96021e81 in -[NSButton performKeyEquivalent:] ()
#4  0x96021cee in -[NSControl _performKeyEquivalent:conditionally:] ()
#5  0x96021bba in -[NSView performKeyEquivalent:] ()
#6  0x96021bba in -[NSView performKeyEquivalent:] ()
#7  0x96021bba in -[NSView performKeyEquivalent:] ()
#8  0x96021bba in -[NSView performKeyEquivalent:] ()
#9  0x96021bba in -[NSView performKeyEquivalent:] ()
#10 0x96021bba in -[NSView performKeyEquivalent:] ()
#11 0x96021923 in -[NSWindow performKeyEquivalent:] ()
#12 0x96183336 in -[NSWindow keyDown:] ()
#13 0x95ffdec7 in forwardMethod ()
#14 0x95ffdec7 in forwardMethod ()
#15 0x95ffdec7 in forwardMethod ()
#16 0x95ffdec7 in forwardMethod ()
#17 0x96108917 in -[NSControl keyDown:] ()
#18 0x95f723a5 in -[NSWindow sendEvent:] ()
#19 0x95f3e311 in -[NSApplication sendEvent:] ()
#20 0x95e9bd0f in -[NSApplication run] ()
#21 0x95e68f14 in NSApplicationMain ()
#22 0x276e in start ()












___

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: should it crash?

2008-12-28 Thread Mudi Dandan
This is a overwriting confirmation dialog for file copying (very much  
like Finder's) and I'm releasing the view because it's not needed  
anymore after the user has chosen.


I have come to that conclusion that performSelectorOnMainThread:  
schedules messages before any other operations on the queue. Could be  
that?



Here is the scenario:

main thread another thread
--  


1. start
2. ask 
main thread to display the panel
3. display panel
4. wait 
on a condition lock

4. user presses a button (shortcut )
5. unlock the condition lock
6. 
continue working
7. ask 
main thread to remove and release panel



8. remove and release panel




9. ??? Update the button and crash




On Dec 29, 2008, at 1:18 AM, Graham Cox wrote:



On 29 Dec 2008, at 4:34 am, Mudi Dandan wrote:


When you press that button the view gets dealloced.


Why?


Why does the button gets updated after I release the view?




What am I missing here ?



Why are you releasing the view? That's the question.

--Graham




___

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


should it crash?

2008-12-28 Thread Mudi Dandan

Hi All,

I have a view (kind of a confirmation dialog)  that has a button that  
dismisses it. When you press that button the view gets dealloced. This  
works fine when using mouse but if I assign a shortcut to the button  
it starts crashing randomly with the following message:


*** -[NSButton drawCell:]: message sent to deallocated instance  
0x193faf60


The reason it crashes only when using the shortcut is obviously  that  
it case of the shortcut it invokes the action before it updates the  
button.


Why does the button gets updated after I release the view?
What am I missing here ?

Mudi





___

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


displaying huge log files

2008-11-29 Thread Mudi Dandan

Hi Guys,

I'm developing an application that generates logs (FTP transcript)  
that could grow really big.
I want  to display this log in simple textview so that the user can  
examine it.
My question : Is it possible to to display a memory mapped file in an  
NSTextView and  in such way that if the file grows the NSTextView  
updates.

If not, could you recommend some technology I should consider.

thanks,
Mudi
___

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 [EMAIL PROTECTED]


Re: forcing menu validation

2008-11-19 Thread Mudi Dandan


On Nov 20, 2008, at 4:15 AM, Mudi Dandan wrote:


On Nov 20, 2008, at 4:01 AM, Quincey Morris wrote:

On Nov 19, 2008, at 18:34, Mudi Dandan wrote:


I'm using automatic menu validation.
The problem comes from that  I exchange close window/close tab (as  
in Safari) shortcuts during the validation process.
Unfortunately -validateUserInterfaceItem: doesn't seem to be  
called when pressing a shortcut, so hitting command-w will close  
the window instead of the current tab. Using the mouse it would  
work fine.


Aside from the issue of whether this is a good thing to do, I think  
it's not going to work because you're making an assumption that  
isn't true.


Switching a key equivalent at validation time could only work if  
all menu items were validated *before* the menu item corresponding  
to the key equivalent is found. I just tried this, and AFAICT it  
finds the menu item *first* and validates just that item. That  
means you're pretty much out luck, as far as doing it at validation  
time.


This behavior contradicts the documentation:

	http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#/ 
/apple_ref/doc/uid/2261-74653-BAJBGJHB


"When you use automatic menu enabling, NSMenu updates the status  
of every menu item whenever a user event occurs."


I think we already knew that it didn't happen literally every  
event, but the part about "every menu item" also appears to be  
false in the key equivalent case.



It works with a little trick that whichever is being validated  
(closetab: or closewindow:) I reassign the shortcuts for both items,
and shortcuts has to be restored in windowDidResignKey: so that  
ordinary windows can be closed with command-w.


___


Ok, I can assure that it technically works but it seems that the menu  
gets confused and it redraws the items with original shortcuts once  
you hover over it with the mouse :(




___

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 [EMAIL PROTECTED]


Re: forcing menu validation

2008-11-19 Thread Mudi Dandan

On Nov 20, 2008, at 4:01 AM, Quincey Morris wrote:

On Nov 19, 2008, at 18:34, Mudi Dandan wrote:


I'm using automatic menu validation.
The problem comes from that  I exchange close window/close tab (as  
in Safari) shortcuts during the validation process.
Unfortunately -validateUserInterfaceItem: doesn't seem to be called  
when pressing a shortcut, so hitting command-w will close the  
window instead of the current tab. Using the mouse it would work  
fine.


Aside from the issue of whether this is a good thing to do, I think  
it's not going to work because you're making an assumption that  
isn't true.


Switching a key equivalent at validation time could only work if all  
menu items were validated *before* the menu item corresponding to  
the key equivalent is found. I just tried this, and AFAICT it finds  
the menu item *first* and validates just that item. That means  
you're pretty much out luck, as far as doing it at validation time.


This behavior contradicts the documentation:

	http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#/ 
/apple_ref/doc/uid/2261-74653-BAJBGJHB


"When you use automatic menu enabling, NSMenu updates the status of  
every menu item whenever a user event occurs."


I think we already knew that it didn't happen literally every event,  
but the part about "every menu item" also appears to be false in the  
key equivalent case.



 It works with a little trick that whichever is being validated  
(closetab: or closewindow:) I reassign the shortcuts for both items,
and shortcuts has to be restored in windowDidResignKey: so that  
ordinary windows can be closed with command-w.


___

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 [EMAIL PROTECTED]


Re: forcing menu validation

2008-11-19 Thread Mudi Dandan


On Nov 20, 2008, at 3:36 AM, Kyle Sluder wrote:

On Wed, Nov 19, 2008 at 9:32 PM, Mudi Dandan <[EMAIL PROTECTED]>  
wrote:

The problem comes from that  I exchange close window/close tab (as in
Safari) shortcuts during the validation process.


Don't do this.  Instead, change the title of the item (be sure to use
localized strings!) and make sure the action hooked up to the item can
differentiate between contexts and do the right thing.

--Kyle Sluder


That's not the same.
Both items are always present like:

with no tabs:   
Close window   command-w
Close tab [disabled]

with tabs:  

Close window   command-shift-w
Close tab commad-w

I guess I just shouldn't do this during validation but when creating/ 
closing tabs.


___

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 [EMAIL PROTECTED]


Re: forcing menu validation

2008-11-19 Thread Mudi Dandan

I didn't.
I'm using automatic menu validation.
The problem comes from that  I exchange close window/close tab (as in  
Safari) shortcuts during the validation process.
Unfortunately -validateUserInterfaceItem: doesn't seem to be called  
when pressing a shortcut, so hitting command-w will close the window  
instead of the current tab. Using the mouse it would work fine.


On Nov 20, 2008, at 3:16 AM, Kyle Sluder wrote:

On Wed, Nov 19, 2008 at 9:12 PM, Mudi Dandan <[EMAIL PROTECTED]>  
wrote:

Is there any way to force a menu validation?


Did you miss the documentation for -autoenablesItems?  The Application
Menu and Pop-up List Progamming Topics for Cocoa guide describes your
options:

1. Automatic menu enabling
2. Calling -setEnabled: manually.

http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#/ 
/apple_ref/doc/uid/2261


So you can't force validation through the NSMenuValidation protocol.
You can only either take the reins or go hands-off.

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

This email sent to [EMAIL PROTECTED]


forcing menu validation

2008-11-19 Thread Mudi Dandan

Hi,

Is there any way to force a menu validation?

Mudi


___

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 [EMAIL PROTECTED]


Re: NSTableView highlited text color

2008-11-05 Thread Mudi Dandan

I believe retuning an NSattributedstring  for object value should work.

On Nov 5, 2008, at 11:30 PM, Andre Masse wrote:


Hi,

When selecting a row in a NSTableView, the default highliting (white  
text on blue background) doesn't work if the text is not black. Is  
there a setting somewhere (in IB) or a method to implement/override  
to fix that? I have a column's cell with its foreground color set to  
gray and it's almost unreadable when the row is selected.  I could  
make my own NSTextFieldCell subclass and override - isHighlited but  
would prefer not to.


Thanks,

Andre Masse


___

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/mudi%40binarynights.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: NSTableView problems

2008-11-02 Thread Mudi Dandan
You call [persiaTable reloadData] inside the tableview's delegate  
method.That will cause an infinite loop I guess.
You shouldn't call reloaddata unless you updated the values for the  
tableview.


On Nov 2, 2008, at 7:53 PM, Priscila J.V. wrote:


Hello,

I'm new in objective C programming. I try to do a program where a  
user can choose the number of partitions of a range in the code  
appears like "valor = 30" (number of rows in table), this range can  
be change from 1 to 100 only by the user, the main goal is using a  
NSTableView to show squares with its respective calculated value  
(drawing both in each cell), the total number of rows contained in  
the table will be manipulated by the user in "valor", but every cell  
must have different data. So if this program works fine, every  
square look like a color degradation, beginning in green, passing  
through brown to achieve red like maximum (you can see the image  
attached).
The question is how can just draw one time every cell without change  
values in my table view?, because every time I click outside my  
XCode project appears in my Log View changes and makes me think that  
the table's work never stops and every time change colors in my  
table view. Is necessary to use an scroll to check the completely  
squares and values on the table, it appears but not works.


I attached my controller class.

I don't know what should I do, I really appreciate some help please.
Thanks,

Priscila Jardón.

_
Inédit ! Des Emoticônes Déjantées! Installez les dans votre  
Messenger !
http://www.ilovemessenger.fr/Emoticones/ 
EmoticonesDejantees 
.aspx 
< 
pic2 
.jpg>___


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/mudi%40binarynights.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Finder like wrapping + truncation

2008-11-01 Thread Mudi Dandan
OK, I have spent the last night by digging into the cocoa text system  
and this is what I could come up with.
I'm sure this is not the best way to do it, but the result is very  
close to what I want to achieve.
Basically I use the NSLayoutmanager to find how it would lay out the  
first line of the text and then do the drawing myself.


Any comment on this?
I really want to do this nicer..

Here is the code:

-(void) drawLabel:(NSString *)label inRect:(NSRect)rect
{
	NSTextStorage *textStorage = [[NSTextStorage alloc]  
initWithString:label];


	NSMutableParagraphStyle *globalStyle = [[NSParagraphStyle  
defaultParagraphStyle] mutableCopy];

[globalStyle setLineBreakMode:NSLineBreakByWordWrapping];
[globalStyle setAlignment:NSCenterTextAlignment];
	[textStorage addAttribute:NSParagraphStyleAttributeName  
value:globalStyle range:NSMakeRange(0, [label length])];


	NSTextContainer *textContainer = [[NSTextContainer alloc]  
initWithContainerSize:rect.size];


NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
[layoutManager addTextContainer:textContainer];
[textStorage addLayoutManager:layoutManager];

int glyphIndex = 0;
NSRange range;

	NSRange glyphRange = [layoutManager  
glyphRangeForTextContainer:textContainer];


int lines = 1;

while (YES)
{
		NSRect lineRect = [layoutManager  
lineFragmentUsedRectForGlyphAtIndex:glyphIndex effectiveRange:&range];

lineRect.origin.x += rect.origin.x;
		lineRect.origin.y = (rect.origin.y + rect.size.height) -  
(lineRect.size.height * lines);


NSString *s = nil;

if (lines == 1)
{
s = [label substringWithRange:range];
}
else
{
s = [label substringFromIndex:range.location];
}


[[NSColor redColor] set];
NSRectFill(lineRect);

		NSMutableParagraphStyle *style = [[NSParagraphStyle  
defaultParagraphStyle] mutableCopy];

[style setLineBreakMode:NSLineBreakByTruncatingMiddle];
[style setAlignment:NSCenterTextAlignment];
		[s drawInRect:lineRect withAttributes:[NSDictionary  
dictionaryWithObject:style forKey:NSParagraphStyleAttributeName]];


if (NSMaxRange(range) >= NSMaxRange(glyphRange))
{
break;
}

glyphIndex = NSMaxRange(range);
lines++;
}   


[textStorage release];
[textContainer release];
[layoutManager release];
}





On Nov 1, 2008, at 2:39 AM, Mudi Dandan wrote:


Hi,

I'm needing a hand with this. I'm trying to emulate the wrapping and  
truncation for icon labels in Finder's icon view.


My first question is: is there any method around for making a string  
to line wrap, and to truncate the second line if it is too long   
(like on the right hand image in the screenshot). Is this supported  
in an API?


The second questions is: can the NSAttributedString render  the  
background for the text  like the ones on the screenshots or is it  
something I have to draw myself?


here's the screenshot:
http://www.binarynights.com/images/Screenshot.png
___

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/mudi%40binarynights.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan

I just found this in the release notes:

"The Cocoa Text System now allows the last visible line to have an  
ellipsis character appended if the entire content cannot fit into the  
specified bounding box. The behavior can be controlled with - 
truncatesLastVisibleLine for text cells. The -lineBreakMode must be  
either NSLineBreakByWordWrapping or NSLineBreakByCharWrapping for this  
option to take effect.. Also, the  
NSStringDrawingTruncatesLastVisibleLine flag can be specified to  
NSStringDrawing APIs that take NSStringDrawingOptions. The  
NSStringDrawingUsesLineFragmentOrigin flag must also be specified for  
the truncation flag to take effect."


On Nov 1, 2008, at 3:41 AM, Mudi Dandan wrote:


Sure I did.
Seems that NSLineBreakByTruncatingMiddle in the NSParagraphStyle  
overrides NSStringDrawingTruncatesLastVisibleLine.

Anyway, I think I can live with that :)

On Nov 1, 2008, at 3:32 AM, Adam R. Maxwell wrote:



On Oct 31, 2008, at 7:20 PM, Mudi Dandan wrote:


Thanks Adam, works grate!
There is only one little flaw that it always truncates the tail  
and I don't see a way to change this.


Did you try setting NSLineBreakByTruncatingMiddle on your  
NSParagraphStyle?  I don't recall trying that with  
NSStringDrawingTruncatesLastVisibleLine myself, but it should work.


--
Adam



___

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/mudi%40binarynights.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan

Sure I did.
Seems that NSLineBreakByTruncatingMiddle in the NSParagraphStyle  
overrides NSStringDrawingTruncatesLastVisibleLine.

Anyway, I think I can live with that :)

On Nov 1, 2008, at 3:32 AM, Adam R. Maxwell wrote:



On Oct 31, 2008, at 7:20 PM, Mudi Dandan wrote:


Thanks Adam, works grate!
There is only one little flaw that it always truncates the tail and  
I don't see a way to change this.


Did you try setting NSLineBreakByTruncatingMiddle on your  
NSParagraphStyle?  I don't recall trying that with  
NSStringDrawingTruncatesLastVisibleLine myself, but it should work.


--
Adam



___

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 [EMAIL PROTECTED]


Re: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan

Thanks Adam, works grate!
There is only one little flaw that it always truncates the tail and I  
don't see a way to change this.


On Nov 1, 2008, at 2:50 AM, Adam R. Maxwell wrote:



On Oct 31, 2008, at 6:39 PM, Mudi Dandan wrote:


Hi,

I'm needing a hand with this. I'm trying to emulate the wrapping  
and truncation for icon labels in Finder's icon view.


My first question is: is there any method around for making a  
string to line wrap, and to truncate the second line if it is too  
long  (like on the right hand image in the screenshot). Is this  
supported in an API?


It's supported as of 10.5.  See  
NSStringDrawingTruncatesLastVisibleLine in NSStringDrawing.h, along  
with appropriate NSParagraphStyle options.


The second questions is: can the NSAttributedString render  the  
background for the text  like the ones on the screenshots or is it  
something I have to draw myself?


I think you'll have to draw that yourself.

--
Adam



___

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 [EMAIL PROTECTED]


Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan

Hi,

I'm needing a hand with this. I'm trying to emulate the wrapping and  
truncation for icon labels in Finder's icon view.


My first question is: is there any method around for making a string  
to line wrap, and to truncate the second line if it is too long  (like  
on the right hand image in the screenshot). Is this supported in an API?


The second questions is: can the NSAttributedString render  the  
background for the text  like the ones on the screenshots or is it  
something I have to draw myself?


here's the screenshot:
http://www.binarynights.com/images/Screenshot.png
___

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 [EMAIL PROTECTED]


addTrackingRect strangness

2008-09-26 Thread Mudi Dandan

Hi Guys,

I have a custom view which is set  in an NSMenuItem.
This view contains 9 rectangles which I would like to track for mouse- 
over event.
I use the the very same method for calculating the size of the rects  
for drawing and the for defining the tracking rects.
What I experience is that  events are fired as if the tracking rects  
are shifted about 4 pixels upwards.

Any ideas?

Mudi
___

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 [EMAIL PROTECTED]


Re: Validating MenuItems before adding them to the menu

2008-09-23 Thread Mudi Dandan

Thanks Erik, that exactly is I was looking for.

Regarding your recommendation as I learned context menus should not  
contain disabled items (check Finder for example) but I'm not really  
sure if this mentioned in the HIG.


Mudi

On Sep 23, 2008, at 7:28 PM, Erik Buck wrote:

See the - (id)targetForAction:(SEL)aSelector method.  When adding  
context menu items, if the target for the menu item's action would  
be nil, just don't add the menu item.


However, I recommend adding all menu items that are ever available  
and just disabling the ones that aren't currently available.  Doing  
that will preserve user's muscle memories about where each item is  
in the list.  Plus, it will let users know what items are sometimes  
available even if they are not currently available.


For more options, see
targetForAction:to:from:
Finds an object that can receive the message specified by the given  
selector.

- (id)targetForAction:(SEL)anAction to:(id)aTarget from:(id)sender
Discussion
If anAction is NULL, nil is returned. If aTarget is nil, NSApp looks  
for an object that can respond to the message—that is, an object  
that implements a method matching anAction. If aTarget is not nil,  
aTarget is returned. The search begins with the first responder of  
the key window. If the first responder does not handle the message,  
it tries the first responder’s next responder and continues  
following next responder links up the responder chain. If none of  
the objects in the key window’s responder chain can handle the  
message, NSApp asks the key window’s delegate whether it can handle  
the message.
If the delegate cannot handle the message and the main window is  
different from the key window, NSApp begins searching again with the  
first responder in the main window. If objects in the main window  
cannot handle the message, NSApp tries the main window’s delegate.  
If it cannot handle the message, NSApp asks itself. If NSApp doesn’t  
handle the message, it asks the application delegate. If there is no  
object capable of handling the message, nil is returned.


___

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/mudi%40binarynights.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Validating MenuItems before adding them to the menu

2008-09-23 Thread Mudi Dandan

Hi,

I'm building a context menu for a table view. The context menu will  
naturally include some of the items from the application menu, but  
when the related actions are not available, I don't want them to show  
in the context menu.
My question is: is there a method to determine whether an item in my  
context menu would be active or not, like it is done in the main menu?


In other words, I need a function that would walk through the  
responder chain and validate the menu items, before putting them in  
the context menu.


Or any suggestion on how you would handle the problem.

Thanks for the help
Mudi


___

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 [EMAIL PROTECTED]


Re: Forcing finalization on the main thread?

2008-09-07 Thread Mudi Dandan
What if you wrapped it in an object where you can use  
performSelectorOnMainThread: for deallocation ?


On Sep 8, 2008, at 12:25 AM, Nick Zitzmann wrote:

I've got a C data structure in a GC-enabled app. I'm deallocating  
the structure when the parent object is finished, in -dealloc and - 
finalize. I've found out the hard way that the data structure is not  
thread-safe, and eventually causes a crash if deallocated on a  
thread other than the main thread. Of course, when GC is running,  
most deallocations occur on another thread.


So I've looked in the documentation and haven't found anything. Is  
there a way to force a collected object to be finalized on the main  
thread, and nowhere else? If so, then how do I do this?


I already tried:

1. Calling -performSelectorOnMainThread:... in the -finalize method.  
Of course it caused the object to be resurrected, which just made  
the problem worse.
2. Allocating the parent object in an unscanned zone, hoping that  
retain/release would make a comeback, but it didn't.


Nick Zitzmann





___

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/mudi%40binarynights.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Getting the Alert volume

2008-07-25 Thread Mudi Dandan
I need to get the Alert Volume set in Preferences so that I can  
respect the user's setting when playing alerts with NSSound.
I have found GetSysBeepVolume() in CarbonSound/Sound.h but  
unfortunately it's deprecated since 10.5.

Any idea how to get that value ?

-Mudi
___

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 [EMAIL PROTECTED]