Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
Hello,

I am interested in adding additional button to the NSPrintPanel dialog
at the very bottom line. Between ( PDF v ) and ( Cancel ). Is that
possible under Leopard? Custom accessory view is not suitable for me.
Even topics from "Extending Printing Dialogs" does not help, because
they does not cover information about how to modify PrintPanel UI
outside changeable panes.
I could do this by getting NSPrintPanel window, accessing its content
view and so on... but I wanted to be sure that this is the only way to
do that. Is there any "right way" to achieve this?

Regards,

Rimas.
___

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: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
Thank you for reply.

>  What are you trying to accomplish?
Basicaly I am trying to merge "Page setup" and "Print" dialogs. That
is easy by using NSPrintPanel's setOptions. But I want to keep "Page
setup" functionality also. I mean, I want to be able to change paper
size for example, without printing. This is quite difficult to do that
when having only "Cancel" and "Print" buttons.

Best Regards,

Rimas.
___

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: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
You are right. And that works very well. Except one thing. After
changing paper size in Print dialog I have two options - to press
Cancel (and revert changes I have made) or to press Print and save new
options + print document. I want only to change paper size and save
that information for later print. I do not want to print at this
moment. In other words, I want to have Print and Page Setup (without
printing) functionality in one (Print) dialog.

>  This is already handled inside the existing print dialog, although not in
> its collapsed state. Clicking the disclosure button adds controls to allow
> you to select the paper size and orientation. There are other controls you
> can add (or remove) as well, search the documentation for
> NSPrintPanelOptions (used with NSPrintPanel's -setOptions: method).

Rimas.
___

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: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
>  If you want that functionality, then we recommend that you have a separate
> Page Setup menu item to invoke that dialog as this is the standard Mac OS X
> behavior and what users will expect.

Ok. I will think about that one more time. Thank you for response.
By the way, as I understand, there is no "legal" methods to get what I
want (additional button in PrintPanel). Right?

Regards,

Rimas.
___

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: how to update the view of NSPrintOperation ?

2008-05-14 Thread Rimas
What are you trying to achieve? Get printed document without UI?

> 2.
>  when we implement printing with cocoa,
>  an NSPrintOperation object is created to control the print operation .
>  NSPrintOperation * printOp = [NSPrintOperation
>  printOperationWithView:viewToPrint printInfo:printInfo];
>  [printOp setShowsPrintPanel:YES];
>  [printOp runOperation];
>
>  I got a native printing dialog, So how can I cancel this programtically? Is
>  it possiable?
>

Rimas
___

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]


Katoeri-Hiragana input underline drawing

2008-12-15 Thread Rimas
Hello,

I am wondering if it is possible to draw this underline manually? I am
talking about underline which is visible when entering text in
Katoeri-Hiragana and characters are in undermined state.
I have tried to use "-
(void)drawGlyphsForGlyphRange:(NSRange)glyphsToShow
atPoint:(NSPoint)origin" and "-
(void)drawBackgroundForGlyphRange:(NSRange)glyphsToShow
atPoint:(NSPoint)origin". But these methods doesn't draw underline.
I have noticed, that marked text range is exactly what I want, but the
problem is - how to know WHEN underline is required? TextView
markedTextAttributes returns dictionary, which has only yellow
background. The same you can see when entering Opt+e, for example.
Looks like this depends on input locale. But I have no idea how
Katoeri-Hiragana should be detected.
Any kind of help is very appreciate.

Regards,
Rimas M.
___

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: Text layout responsibility

2008-12-15 Thread Rimas
Hello Gordon,

Have you installed 10.6 to run test?

Regards,
Rimas

>NSTextContainer has been broken for some time now and I can't even get
> an acknowledgement from DTS of the bug in spite of the fact that I've had
> others verify it on independent machines using Apple, Inc's own sample code.
> I'm trying (with difficulty) to get 10.6 installed on a separate disk to see
> if the bug is still there.  When the container is expanding, it works.  When
> the container is shrinking, lineFragmentRectForProposedRect goes into an
> infinite loop, ever increasing it's height, which I have to terminate when
> it hits the bottom of the container.  If it is still there in 10.6, I'm
> going to start filing bug reports on it again.
___

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: Text layout responsibility

2008-12-15 Thread Rimas
I have tried to modify my text container in mentioned method (-
(void)layoutManager:(NSLayoutManager *)layoutManager
didCompleteLayoutForTextContainer:(NSTextContainer *)textContainer
atEnd:(BOOL)layoutFinishedFlag). At a first glance looks like this
works. But I decided to stay on  the earlier way - delay text
container modification in response to
NSTextStorageDidProcessEditingNotification.

Rimas M.
___

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


Text layout responsibility

2008-12-11 Thread Rimas
Hello list,

I have performed quick search through  the list and couldn't find
answer to my question.

I am trying to implement editable text view which changes text
position (paragraphs positions, to be exact) according to the some
text attributes. I know, that NSTextContainer is responsible for line
rects calculation when text should be placed in known shape. Is it
responsible for this when position depends on text attributes also?
Reason I am asking is that in method
lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:
I do not have any information about glyphs or characters range to be
placed in proposed rect, only rect coordinates. Should I do this
manually by accessing container -> text view -> text storage? Maybe
NSLayoutManager or NSTypeSetter subclass would be better choice?

Another thing I'd like to ask, is where should I adjust text view/text
container size if this is necessary while typing? I have tried to do
this after getting NSTextStorageDidProcessEditingNotification
notification. But that raises an exception:

>> Exception raised during posting of notification.  Ignored.  exception: '*** 
>> NSRunStorage, _NSBlockNumberForIndex(): index (0) beyond array bounds (0)'  
>> invoked observer method: '*** -[MyTestController 
>> _TextStorageContentChanged:]'  observer: 0x14d60b10  notification name: 
>> 'NSTextStorageDidProcessEditingNotification'  <<

Any help is very appreciate.

Regards,
Rimas M.
___

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: Text layout responsibility

2008-12-12 Thread Rimas
Hello Martin,

Thank you for your response.

> The text container isn't really responsible for that. It's job is to merely
> define the geometric space available for text. I would expect you'll find it
> easier to override NSTypesetter's
> "willSetLineFragmentRect:forGlyphRange:etc:" method.

I will check this out.

> NSLayoutManager is touchy about changing NSTextContainer geometry during
> layout, but I would expect it to be safe to do so in response to that
> notification. Are you perhaps altering the contents of your NSTextStorage in
> response to layout events/notifications? Can you post the full stack
> backtrace for the exception?

#0  0x92811e17 in objc_exception_throw
#1  0x9071bf2b in +[NSException raise:format:arguments:]
#2  0x9071bf6a in +[NSException raise:format:]
#3  0x934598cc in _NSBlockNumberForIndex
#4  0x93462baf in -[NSLayoutManager
textContainerForGlyphAtIndex:effectiveRange:]
#5  0x934629c8 in -[NSLayoutManager glyphRangeForTextContainer:]
#6  0x0026d4ab in -[MyTestController textDidChange_private:] at
MyTestController.m:2178
#7  0x0026d08d in -[MyTestController TT_TextStorageContentChanged:] at
MyTestController.m:2017

This raises after changing text view container size
([__viewTextContainer setContainerSize:NSMakeSize(MAX_SIZE,
MAX_SIZE)];), when calling [__viewLayoutManager
glyphRangeForTextContainer:__viewTextContainer];. This
(glyphRangeForTextContainer  call) is required to use NSRect __realRec
= [__viewLayoutManager usedRectForTextContainer:__viewTextContainer];

Rimas M.
___

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: Text layout responsibility

2008-12-12 Thread Rimas
> My first suspicion was wrong, but I think you're experiencing a similarly
> touchy aspect of NSLayoutManager.
>
> I believe the problem is that the NSLayoutManager attached to the text
> storage might not have been notified of the edit before you get the
> notification. So when you change the container geometry layout is triggered
> for an intermediate/invalid state. In your NSTextStorageDidProcessEditing
> callback try using "performSelector:withObject:afterDelay:" to schedule your
> container changes and see if that fixes the problem.

Looks like delaying text container modification stops throwing
exception. But I should say, this is a strange behavior. I haven't
seen any notes about that in documentation. Maybe missed something.

Anyway, thank you for your help Martin.

Regards,

Rimas M.
___

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: Text layout responsibility

2008-12-12 Thread Rimas
> My suspicion is that you are
> modifying the contents of the NSTextStorage or changing the NSTextContainer
> geometry in response to a layout event. You cannot safely do either while
> layout is active on the stack.

Here is the stack:

#0  0x92811e17 in objc_exception_throw
#1  0x9071bf2b in +[NSException raise:format:arguments:]
#2  0x9071bf6a in +[NSException raise:format:]
#3  0x934598cc in _NSBlockNumberForIndex
#4  0x938944cc in -[NSLayoutManager(NSPrivate)
_invalidateLayoutForExtendedCharacterRange:isSoft:invalidateUsage:]
#5  0x93490a48 in -[NSLayoutManager(NSPrivate)
_invalidateLayoutForExtendedCharacterRange:isSoft:]
#6  0x9349271f in -[NSLayoutManager textContainerChangedGeometry:]
#7  0x9348a92b in -[NSTextContainer setContainerSize:]
#8  0x0026d71a in -[MyTestController textDidChange_private:] at
MyTestController.m:2238
#9  0x0026cbdd in -[MyTestController _TextStorageContentChanged:] at
MyTestController.m:2017
#10 0x961632dc in _nsnote_callback
#11 0x90683aba in __CFXNotificationPost
#12 0x90683d93 in _CFXNotificationPostNotification
#13 0x96160440 in -[NSNotificationCenter 
postNotificationName:object:userInfo:]
#14 0x96169c88 in -[NSNotificationCenter postNotificationName:object:]
#15 0x935450b5 in -[NSTextStorage processEditing]
#16 0x934749cf in -[NSTextStorage endEditing]
#17 0x93542e8d in -[NSTextView insertText:replacementRange:]
#18 0x935423d3 in -[NSTextView insertText:]
#19 0x93541efa in
-[NSKeyBindingManager(NSKeyBindingManager_MultiClients)
flushTextForClient:]
#20 0x9354044f in -[NSTSMInputContext interpretKeyEvents:]
#21 0x9353ff1a in -[NSView interpretKeyEvents:]
#22 0x9353fe2a in -[NSTextView keyDown:]
#23 0x003a8cca in -[MyTextView keyDown:] at MyTextView.m:896
#24 0x934b03a5 in -[NSWindow sendEvent:]
#25 0x002e9d98 in -[MyDocumentWindow sendEvent:] at MyDocumentWindow.m:85
#26 0x9347c311 in -[NSApplication sendEvent:]
#27 0x0007d420 in -[MyApplication sendEvent:] at MyApplication.m:1174
#28 0x933d9d0f in -[NSApplication run]
#29 0x933a6f14 in NSApplicationMain
#30 0x0001705b in main at main.m:106


I am trying to change TextContainer size via [__viewTextContainer
setContainerSize:__sizeToSet]; And this is called in response to
NSTextStorageDidProcessEditingNotification.

The reason I need to change container size, is to update it to keep
all entered text. All the time I am keeping text container as small as
it is possible.

Rimas M.
___

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: Text layout responsibility

2008-12-12 Thread Rimas
Thank you for the tip. I'll try this also.

Rimas M.

On Fri, Dec 12, 2008 at 1:18 PM, chaitanya pandit
 wrote:
> Try changing the container size once the layout is complete, you can do this
> by using the delegate method:
> - (void)layoutManager:(NSLayoutManager *)layoutManager
> didCompleteLayoutForTextContainer:(NSTextContainer *)textContainer
> atEnd:(BOOL)layoutFinishedFlag
> and checking the layoutFinishedFlag.
>
> But you need to take care of not entering an infinite loop.
___

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


Properly symbol fonts handling in Cocoa

2009-03-09 Thread Rimas
Hello list,

Last few days I was trying to understand how symbol fonts (wingdings,
webdings X, etc) should be properly handled with cocoa text system. As
a good example could be Adobe Photoshop and Apple Pages. Both behaves
in the same way and I want to achieve the same result.
For example if I choose Wingdings font and type "PO", I see two flag
symbols. If I change font to any other (Arial, Times, Helvetica etc.)
I see characters I have entered by keyboard layout (PO). Also, If I
copy text while Wingdings font is selected, and paste it to another
app, I am getting "PO".
Searching through the list gave me few ideas. But none of them I found
very useful. One of them is to map characters to different codes (by
adding 0x00F000). This works, but I doubt this is correct way, because
that brakes copy/paste mechanism and when converting back to
Arial/Times.. symbols needs to be remapped again. Unless this could be
done in auto way. I think only glyphs should be used from font and
mapping should be done by text system. The problem is - I have no idea
how to do that.

Any help is appreciate.

P.S. default behavior is like TextEdit: say we have "PO" and after
choosing Wingdings font is changed to default Lucida Grande.

Best Regards,

Rimas M.
___

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


Custom field editor context menu

2010-06-07 Thread Rimas M.
Hello list,

Congrats on WWDC week. Have great sessions :)

I have some troubles implementing custom context menu in NSTextField.
While field is editing, field editor take control over field. So I
implemented my custom field editor:

- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client
{
if (sender && client are OK)
{
static MyCustomFieldEditorView *_editor = nil;

if (_editor == nil)
{   
_editor = [[MyCustomFieldEditorView alloc]
initWithFrame:[(NSTextField*)client frame]];
}

[_editor setMenu:[(NSTextField*)client menu]];
return _editor;
}
return nil;
}

Field editor is replaced with my own one, my menu is displayed. Great.
But that works if there is no selected text in editor. But if any, I
am getting:

Spelling suggestion 1
Spelling suggestion 2
...
Spelling suggestion N
-
Ignore Spelling
Learn Spelling
-
Search in Spotlight
Search in Google
-
Look up in Dictionary
-
My Custom menu item 1
...
My Custom menu item N

I want menu to have only my custom items. No spelling & co above my
items. Always. Even with some text selected.

How could I achieve that?

Any help is very appreciate.

Regards,

Rimas M.
___

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: Custom field editor context menu

2010-06-07 Thread Rimas M.
Hi Martin,

You are right - that works. I can swear that I have tried this before.
But looks like was overridden to much methods. Now I have started this
part from scratch and..tadaaa.
Thank you.

Regards,

Rimas M.

On Tue, Jun 8, 2010 at 12:17 AM, Martin Wierschin  wrote:
> Hi Rimas,
>
> I want menu to have only my custom items. No spelling & co above my
> items. Always. Even with some text selected.
>
> How could I achieve that?
>
> In your NSTextView subclass, you can override -[NSTextView menuForEvent:] to
> return your custom menu.
> ~Martin
>
___

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


Best way to compare CGFloats

2010-06-30 Thread Rimas M.
Hello,

I am stuck with floats (doubles, to be precise) comparison.
In part of my app, I am dealing with NSPoint components (x, y)
comparison. On 32bit architecture NSPoint components are floats, and
direct comparison ( float1 == float2 ) works fine. But on 64bit, they
are doubles and '==' does not work due to precision.

Lets take an example: C and D are NSPoints. Lets say C is
(1.000444089209850063, whatever) and D is
(1.00, whatever).
If my code is: if (C.x == D.x) thenDoSomething; , then thenDoSomething
is not called. Of course.

But on my needs, float is more than enough for precision.

So question is, what is the most efficient (performance side) and
simplest (coding side) way to compare those bastards?

At the moment I am thinking about:

a) BOOL _floatsOrDoublesAreEqual = ( (float)C.x == (float)D.x);

b) BOOL _floatsOrDoublesAreEqual = ( fabs(C.x - D.x) <= _epsilon ); ,
where _epsilon is something like 0.0001.

Regards,

Rimas M.
___

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: Best way to compare CGFloats

2010-06-30 Thread Rimas M.
Thanks everyone for answers. Now situation is more clear.

On Wed, Jun 30, 2010 at 12:14 PM, Alastair Houghton
 wrote:
>
> fabs is the right way to do this in most cases, *but* with co-ordinate values 
> it may be that you are actually more interested in the distance of one point 
> from the other---i.e. you might in fact be interested in
>
>  CGFloat dx = C.x - D.x, dy = C.y - D.y;
>  BOOL pointsAreEqual = (dx * dx + dy * dy) < epsilonSquared;
>
> It rather depends on what you want, and that's going to differ from one 
> application to another.

In my case I am interested in x's and y's comparison. Not points as
themselves. But your suggestion gave me another question, which I have
never thought about before - how NSEqualPoints, ...Rects etc works? I
guess they *must* be safe to use, because NSPoint, NSRect etc relies
on floats/doubles. Or they uses the same '==' and are TRUE only if
points/rects are *really* equal?

Best Regards,

Rimas M.
___

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: Best way to compare CGFloats

2010-06-30 Thread Rimas M.
On Wed, Jun 30, 2010 at 1:06 PM, Alastair Houghton
 wrote:
> I think they test for exact equality.  Whether that's documented or not I'm
> not certain, but disassembling those functions appears to support that
> conclusion.

I see. Hope that will not cause any unexpected problems. For now I am
going to use:

#define cDefaultFloatComparisonEpsilon  0.0001
#define cEqualFloats(f1, f2, epsilon)   ( fabs( (f1) - (f2) ) < epsilon )
#define cNotEqualFloats(f1, f2, epsilon)( !cEqualFloats(f1, f2, 
epsilon) )

Thank you for your help.

Regards,

Rimas M.
___

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


Long delay of NSPopUpButton first click

2011-08-02 Thread Rimas M.
Hello list,

I am trying to do quite simple thing - add a popup with all fonts, available
on system. Each item of menu, should be displayed in corresponding font. As
an example could be all iWork apps. When you dealing with text, you have a
popup with fonts, and each font name is displayed with "preview" of that
font.

I have tried to do that in very usual way:
- iterating over available fonts
- creating a NSMenuItem for each font, setting it up
- setting menuItem's attributedTitle with corresponding NSFontAttributeName
- adding menuItem to the popup.

This works as expected, but after app launch, when I click on that popup for
the first time, delay until menu is shown is unacceptable. Usually it takes
a few seconds. All following times I click on the popup, the menu is
displayed immediately. Until relaunch of the app..

Shark has not provided any useful information. So I am wondering - I have
missed something, or should I use some "tricks" to avoid that delay?

Any thoughts are very welcome.

Regards,

Rimas M.
___

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: Long delay of NSPopUpButton first click

2011-08-03 Thread Rimas M.
Hi Glenn,

Thank you for answering. Now I can understand why menu item title is black
in fonts popup of iWork apps. Even if they are selected.

Regards,

RImas M.

On Tue, Aug 2, 2011 at 6:13 PM, Glenn L. Austin wrote:
>
> Yes -- don't do that!!!
>
> You are asking the system to not only iterate through all of the fonts and
> styles, but to also set each menu item's text to that font and style.  The
> iteration part is fairly quick, setting the item text requires that the font
> be loaded and prepared for use just to draw that *one text item*.  Preparing
> each font takes a small amount of time, but multiplied by the 100+ fonts on
> a system gives you a noticeable time delay.
>
> Most applications that draw the font menu using the fonts actually
> pre-create the menu items as images of the menu item text, then only display
> the image in the menu.
>
> (History: I've worked on both the AppleWorks and the Microsoft Office 2011
> font menus in my career.)
>
___

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: Long delay of NSPopUpButton first click

2011-08-04 Thread Rimas M.
Drawing item titles into image and caching them for later use works nice.
But I have noticed unacceptable side effect. Normally, when menu is
displayed you can press any letter key, and menu will scroll to the first
item, which title starts with that letter. In my case , NSMenuItems does not
have titles and that does not work. Looking for workaround to maintain this
functionality.
___

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


Catching actions of fonts "Typography" panel

2011-08-24 Thread Rimas M.
Hello folks,

I am wondering - how it is possible to catch action, when sender is a
Typography (the one that can be found in Fonts panels action menu at the
left bottom side - http://db.tt/CC1hX8c )? If I have a text view with
selection and I choose something in it (for example Alternative stylistic
set for certain font), I am getting notification that text storage of that
text view has changed. That is way to abstract for my needs. Fair enough
would be something like "font has changed". Or simply changeFont: for first
responder.

By getting that action I would be able to implement that changes for any of
my views. Not only textview.

Any thoughts?

Best Regards,

Rimas M.
___

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: Catching actions of fonts "Typography" panel

2011-08-24 Thread Rimas M.
Delegate methods could be used if there is an editable textview. But what if
not? For other things we have "changeFont:, changeColor:,
changeAttributes:". Unfortunately, neither of them are called by action I
have mentioned.

Regards,

Rimas M.

On Wed, Aug 24, 2011 at 1:49 PM, Mike Abdullah wrote:

> NSTextView has plenty of other delegate methods that will tell you why a
> change is about to happen. Use those to decide how to handle after the
> change has occurred.
>
> Sent from my iPad
>
> On 24 Aug 2011, at 11:39 AM, "Rimas M."  wrote:
>
> > Hello folks,
> >
> > I am wondering - how it is possible to catch action, when sender is a
> > Typography (the one that can be found in Fonts panels action menu at the
> > left bottom side - http://db.tt/CC1hX8c )? If I have a text view with
> > selection and I choose something in it (for example Alternative stylistic
> > set for certain font), I am getting notification that text storage of
> that
> > text view has changed. That is way to abstract for my needs. Fair enough
> > would be something like "font has changed". Or simply changeFont: for
> first
> > responder.
> >
> > By getting that action I would be able to implement that changes for any
> of
> > my views. Not only textview.
> >
> > Any thoughts?
> >
> > Best Regards,
> >
> > Rimas M.
> > ___
> >
> > 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/cocoadev%40mikeabdullah.net
> >
> > This email sent to cocoa...@mikeabdullah.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


Re: Catching actions of fonts "Typography" panel

2011-08-24 Thread Rimas M.
You are absolutely right, Martin. That was I have thought at the beginning.
But it didn't worked. Now I have checked more deeply and looks like I have a
bug in my responders chain which prevents me from getting changeAttributes:.

Best Regards,

Rimas M.

On Thu, Aug 25, 2011 at 1:04 AM, Martin Wierschin  wrote:

The actions you mentioned, font typography options set via Apple's
> Typography panel, will send "changeAttributes:" to the first responder. In
> your method implementation you'll want to call "convertAttributes:" on the
> "sender", eg:
>
> - (void) changeAttributes:(id)sender
> {
>NSDictionary* oldAttrs = [self myCurrentAttributes];
>NSDictionary* newAttrs = [sender convertAttributes:oldAttrs];
>// ferret out changes
> }
>
> If you have a NSTextView subclass you can override that method and do the
> work there just as easily.
>
> ~Martin
>
>
___

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: Text rendered in NSImage is fuzzy

2011-08-26 Thread Rimas M.
Sorry for touching this old thread. I just want to be sure.

If I am using Core Text (CTLineDraw(line, bitmapDrawContext);) to draw my
text into bitmap context, there is no way to get sub-pixels antialiasing if
resulting image has transparent background?
Currently it looks: http://db.tt/Rtiu7B1

Regards,

Rimas M.

On Sun, Jun 27, 2010 at 11:47 PM, Ken Ferry  wrote:

> I don't think this is likely to be the problem in this case.  Text looks
> good no matter where you draw it.
>
> In this case, I think the problem is more likely either
> (1) A lack of what Quartz calls font smoothing, more popularly known
> as subpixel
> rendering <http://en.wikipedia.org/wiki/Subpixel_rendering>.
> (2) The resulting image being drawn non-pixel aligned, incurring double
> anti-aliasing effects.
>
> We would be able to tell from a screenshot.
>
> I would guess (1) is more likely. Dave, if you were to read that wikipedia
> article and think about it carefully, you would realize that doing full
> featured transparency with font smoothing would require six channels (red,
> red alpha, green, green alpha, blue, blue alpha) instead of the usual ARGB
> backing stores bitmaps use. The easiest fix when applicable is to make sure
> the image isn't transparent.  Fill the NSImage with an opaque color before
> doing the text drawing.
>
___

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: Text rendered in NSImage is fuzzy

2011-08-26 Thread Rimas M.
On Fri, Aug 26, 2011 at 5:21 PM, Kyle Sluder  wrote:

> On Aug 26, 2011, at 7:13 AM, "Rimas M."  wrote:
>
> > If I am using Core Text (CTLineDraw(line, bitmapDrawContext);) to draw my
> > text into bitmap context, there is no way to get sub-pixels antialiasing
> if
> > resulting image has transparent background?
>
> Correct. Subpixel antialiasing algorithms require an opaque background.
>
> --Kyle Sluder
>

Thank you for confirmation.

Regards,

Rimas M.
___

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: Long delay of NSPopUpButton first click

2011-08-28 Thread Rimas M.
Well.. that worked. Generally. But those images must have transparent
background. And as I have discovered, when dealing with text drawing, that
causes loose of sub-pixels antialiasing. This is unacceptable. Will need to
use NSAttributedString+attributedTitle way... Any hints on speeding up menu
showing time on the first click?

Regards,

Rimas M.

On Thu, Aug 4, 2011 at 12:07 PM, Rimas M.  wrote:

> Drawing item titles into image and caching them for later use works nice.
> But I have noticed unacceptable side effect. Normally, when menu is
> displayed you can press any letter key, and menu will scroll to the first
> item, which title starts with that letter. In my case , NSMenuItems does not
> have titles and that does not work. Looking for workaround to maintain this
> functionality.
___

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: Long delay of NSPopUpButton first click

2011-08-31 Thread Rimas M.
On Mon, Aug 29, 2011 at 7:13 PM, Jens Alfke  wrote:

>
> On Aug 28, 2011, at 11:25 PM, Rimas M. wrote:
>
> Well.. that worked. Generally. But those images must have transparent
> background. And as I have discovered, when dealing with text drawing, that
> causes loose of sub-pixels antialiasing. This is unacceptable. Will need to
> use NSAttributedString+attributedTitle way... Any hints on speeding up menu
> showing time on the first click?
>
>
> Personally, I would find it worse for an app load and render every
> installed font (I have something like 1,000), than for it to draw that menu
> quickly but slightly less smoothly.
>
> Can’t you render the text onto a solid background that’s been filled in
> with the menu-item background color?
>
> —Jens
>

Not really. Unless I am missing something. Menu-item's background is
changing when item is selected (blue one, by default).

I am wondering how iWork apps was able to solve this. Their menu has full
antialiasing and responds to keyboard for selecting items by first letter of
title. This suggests AttrbutedString way. But it loads fast... Strange.

Regards,

Rimas M.
___

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: Long delay of NSPopUpButton first click

2011-09-05 Thread Rimas M.
On Mon, Aug 29, 2011 at 6:40 PM, Glenn L. Austin wrote:

> <...>
>
Also, just because you're using an image for the menu item doesn't mean that
> you can't set the title of the item.
>

Yes - I can set the title of item with an image, but I don't need
"duplicated" title which is presented by both - image and title itself:
https://www.dropbox.com/s/9psws3vavxpkya4/Duplicated-menuitem-title.png
All I need is "nice" font preview (which should be done by using image) and
keep first letter of title shortcut.

Regards,

Rimas M.
___

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: Long delay of NSPopUpButton first click

2011-09-05 Thread Rimas M.
On Wed, Aug 31, 2011 at 6:04 PM, Glenn L. Austin wrote:

>
> Having worked on that code at one time, they are doing *exactly* what I
> outlined -- they are pre-creating item images (image with mask) and putting
> plain text titles in the menu item and drawing the images with the proper
> menu background for the menu item content.
>
> They are NOT using AttributedString.
>

Going to try masked image way right now. As for plain text title, I am
confused, because if I do that, menu items have two titles - image and plain
text:
https://www.dropbox.com/s/9psws3vavxpkya4/Duplicated-menuitem-title.png

Regards,

Rimas M.
___

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


Getting notification about new font is available

2011-09-05 Thread Rimas M.
Hello list,

During weekend I was trying to figure out how to know when new font becomes
available. The only method I was able to find is - (BOOL)fontManager:(id)*
theFontManager*
willIncludeFont:(NSString
 *)*fontName* of NSFontManager. But according to the documentation: *
Important:*  This delegate method is not called in Mac OS X versions 10.3
and later. So it does not work... (I have tried - just in case).

For example: if I have a RTF file with "Noteworthy" family font (which is
available by default on Lion, but not in SL), after opening it on SL
(TextEdit) the font becomes visible in NSFontPanel for that app running
session. I need to catch that moment to update my own fonts popup.

Any thoughts are very appreciate.

Best Regards,

Rimas M.
___

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: Long delay of NSPopUpButton first click

2011-09-06 Thread Rimas M.
OK. Answering by myself - to avoid title "duplication" it is possible by
setting "small-invisible" attributed title.

Rimas M.

On Tue, Sep 6, 2011 at 9:47 AM, Rimas M.  wrote:

>
> Going to try masked image way right now. As for plain text title, I am
> confused, because if I do that, menu items have two titles - image and plain
> text:
> https://www.dropbox.com/s/9psws3vavxpkya4/Duplicated-menuitem-title.png
>
> Regards,
>
> Rimas M.
>
___

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: Long delay of NSPopUpButton first click

2011-09-06 Thread Rimas M.
M.. Actually not. I am using "setImage:" of NSMenuItem to keep default
highlighted item selection drawing and large menu scrolling with
scroll-wheel.

Rimas M.

On Tue, Sep 6, 2011 at 4:40 PM, Glenn L. Austin wrote:
>
> Yes, you will need to set the item's title, unless accessibility isn't an
> issue for you or all of your customers.
>
> Since you're using a view for the menu item in order to draw the contents
> (right?), that view is what the user sees on the screen, but the text is
> what the accessibility system uses.
>
___

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: Getting notification about new font is available

2011-09-07 Thread Rimas M.
Hello Martin,

Thank you - that helped. And, as you have mentioned, additional checking is
required due to "unnecessary" update calls.

Regards,

p.s. I still don't like Xcode 4. I have overlooked NSFont's class
notifications because of removed TOC at documentation viewer.

Rimas M.

On Tue, Sep 6, 2011 at 9:21 PM, Martin Wierschin  wrote:

> > During weekend I was trying to figure out how to know when new font
> becomes available.
>
> You can use NSFontSetChangedNotification:
>
>
> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSFont_Class/Reference/Reference.html
>
> Though in my experience it's posted a lot more often than necessary, so you
> might want to pay attention to how much work you do in response, or
> delay/batch your work.
>
> ~Martin
>
>
___

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


Sandboxing + NSSavePanel's accessoryView

2011-10-10 Thread Rimas M.
Hello,

I am trying to enable sandboxing in my app, and I am dealing with a very
strange behavior. I am not sure if this is a bug of Lion/Sandboxing or I
have missed something in documentation.

In save panel I am using a custom accessoryView which is set in "-
(BOOL)prepareSavePanel:(NSSavePanel *)savePanel". I am setting setting
accessory view to the real one only if savePanel's "- (BOOL)isExpanded"
returns YES. Otherwise I am setting it to nil.
To handle save panel's expansion I am using "- (void)panel:(id)sender
willExpand:(BOOL)expanding" from NSOpenSavePanelDelegate. If expanding ==
YES, I am setting the real accessory view, and nil if expanding==NO.

That worked very well on Snow Leopard. It even works well on Lion without
sandboxing. But if sandboxing is enabled, it does not work. When save panel
is displayed and I am trying to expand it, expands and collapses back. It is
impossible to expand it.

Log has showed, that I am getting - (void)panel:(id)sender
willExpand:(BOOL)expanding with expanding==YES and the second one
with expanding==NO. At the moment I have no clue what is going on.

Any thoughts about this behavior would be very appreciate.

Best Regards,

Rimas M.
___

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


Drawing FULL NSAttributedString

2011-04-27 Thread Rimas M.
Hi folks,

Last few days I am trying to solve very strange puzzle - how to draw
FULL attributed string.

Short story:

I have a NSTextStorage object, which holds my formatted string
information. I am editing it via NSTextView (NSLayoutManager +
NSTextContainer + my NSTextStorage) mechanism. That works great until
I am dealing with drawing. To find out rect, which will be required to
fit my text, I am using -
(NSRect)usedRectForTextContainer:(NSTextContainer *)aTextContainer of
NSLayoutManager. To draw actual content I am using
drawBackgroundForGlyphRange:(NSRange)glyphsToShow
atPoint:(NSPoint)origin and
drawGlyphsForGlyphRange:(NSRange)glyphsToShow atPoint:(NSPoint)origin
from the same NSLayoutManager. And that works great for 90% of time.
But I need 100%.

Problem:

Actually I am dealing with two drawing problems:

1. When my attributed string (NSTextStorage) has a shadow, made by
using Fonts panel, it is NOT INCLUDED when trying to find out used
rect by calling [myLayoutManager
usedRectForTextContainer:myTextContainer]. Never. The situation can be
easily demonstrated with TextEdit:
https://www.dropbox.com/s/vt21zpq46xl0gb5/Text-with-cropped-shadow.png
. The same I am getting in my app. But I need a shadow, therefor I
have set it. To draw it correctly, I need a bounding (used) rect,
which counts in a shadow attribute. Is it possible at all using cocoa
text system?

2. With some fonts (for example Eccentric Std, Palemonas, some others
which i can't remember right now) the [myLayoutManager
usedRectForTextContainer:myTextContainer] returns rect which does not
covers WHOLE text. Sometimes diacritic symbols of the very top line
are missing 
(https://www.dropbox.com/s/dpjjugzxcnp771r/Missing-diacrytic-symbol.png
<- both letters are the same "Alt + e + e = é" combination), sometimes
the first left symbol is cropped
(https://www.dropbox.com/s/33mfgoqwbgwcvg1/Cropped-left-side-1.png,
https://www.dropbox.com/s/kbgfdzuhcr1svht/Cropped-left-side-2.png,
https://www.dropbox.com/s/ntxgufl8e562uep/Cropped-left-side-3.png).
Question is the same - how to get rect, which would fit my whole text.

Any help is very appreciate.

p.s. don't hesitate to ask for an additional information. I could even
make a small sample app if required.

Regards,

Rimas M.
___

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: Drawing FULL NSAttributedString

2011-05-03 Thread Rimas M.
Hello Aki,

Thank you for reply.
Looks like I will need to learn lots of new things, because fonts
metrics are unknown world for me.

I have played a bit with "rect of glyph" from NSFont and
NSLayoutManager. Some useful information can be found. But lots of
unclear things are mostly with baselines and offsets of them.. For
example NSFont's boundingRectForGlyph: returns rect, which looks like
gonna fit whole glyph, but currently I have no idea how to calculate
its position (x and y) in the line of TextView/LayoutManager.

Regards,

Rimas M.

On Wed, Apr 27, 2011 at 11:06 PM, Aki Inoue  wrote:
> Rimas,
>
> Typically the text layout system including the Cocoa Text System works in the 
> typographic metrics that's based on the information embedded in the font.  
> So, most layout information returned by NSLayoutManager is in the typographic 
> metrics if not documented otherwise.
>
> The information you're seeking here is usually called the rendering or image 
> metrics.  They are based on the actual rendering results in the graphics 
> system.
>
> The typographic metrics and image metrics are usually not compatible.  Also, 
> the image metrics usually requires the rendering result (various graphical 
> settings could change the pixels touched).
>
>
>> 2. With some fonts (for example Eccentric Std, Palemonas, some others
>> which i can't remember right now) the [myLayoutManager
>> usedRectForTextContainer:myTextContainer] returns rect which does not
>> covers WHOLE text.
>
> You can calculate the image bounds by union'ing the bounds of each glyph in 
> the layout manager.  See -[NSFont getBoundingRects:forGlyphs:count:].
>
>> To draw it correctly, I need a bounding (used) rect,
>> which counts in a shadow attribute. Is it possible at all using cocoa
>> text system?
> This really requires the rendering result.  You can "estimate" the bounds by 
> applying the shadow params to the bounding rect from above.
>
> Aki
>
> On 2011/04/27, at 8:34, Rimas M. wrote:
>
>> Hi folks,
>>
>> Last few days I am trying to solve very strange puzzle - how to draw
>> FULL attributed string.
>>
>> Short story:
>>
>> I have a NSTextStorage object, which holds my formatted string
>> information. I am editing it via NSTextView (NSLayoutManager +
>> NSTextContainer + my NSTextStorage) mechanism. That works great until
>> I am dealing with drawing. To find out rect, which will be required to
>> fit my text, I am using -
>> (NSRect)usedRectForTextContainer:(NSTextContainer *)aTextContainer of
>> NSLayoutManager. To draw actual content I am using
>> drawBackgroundForGlyphRange:(NSRange)glyphsToShow
>> atPoint:(NSPoint)origin and
>> drawGlyphsForGlyphRange:(NSRange)glyphsToShow atPoint:(NSPoint)origin
>> from the same NSLayoutManager. And that works great for 90% of time.
>> But I need 100%.
>>
>> Problem:
>>
>> Actually I am dealing with two drawing problems:
>>
>> 1. When my attributed string (NSTextStorage) has a shadow, made by
>> using Fonts panel, it is NOT INCLUDED when trying to find out used
>> rect by calling [myLayoutManager
>> usedRectForTextContainer:myTextContainer]. Never. The situation can be
>> easily demonstrated with TextEdit:
>> https://www.dropbox.com/s/vt21zpq46xl0gb5/Text-with-cropped-shadow.png
>> . The same I am getting in my app. But I need a shadow, therefor I
>> have set it. To draw it correctly, I need a bounding (used) rect,
>> which counts in a shadow attribute. Is it possible at all using cocoa
>> text system?
>>
>> 2. With some fonts (for example Eccentric Std, Palemonas, some others
>> which i can't remember right now) the [myLayoutManager
>> usedRectForTextContainer:myTextContainer] returns rect which does not
>> covers WHOLE text. Sometimes diacritic symbols of the very top line
>> are missing 
>> (https://www.dropbox.com/s/dpjjugzxcnp771r/Missing-diacrytic-symbol.png
>> <- both letters are the same "Alt + e + e = é" combination), sometimes
>> the first left symbol is cropped
>> (https://www.dropbox.com/s/33mfgoqwbgwcvg1/Cropped-left-side-1.png,
>> https://www.dropbox.com/s/kbgfdzuhcr1svht/Cropped-left-side-2.png,
>> https://www.dropbox.com/s/ntxgufl8e562uep/Cropped-left-side-3.png).
>> Question is the same - how to get rect, which would fit my whole text.
>>
>> Any help is very appreciate.
>>
>> p.s. don't hesitate to ask for an additional information. I could even
>> make a small sample app if required.
>>
>> Regards,
>>
>> Rimas M.
>> _

Vertical alignment in NSTextView

2011-05-03 Thread Rimas M.
Hello,

I continue my fight with cocoa text system :)) At the moment I am loosing..

Now I am trying to implement vertical text alignment in NSTextView. If
I would need only drawing, would be quite easy. But I need to maintain
an editing capability.

The thing I am talking about is very similar (or even the same) to the
text writing inside shape (rectangle) using Keynote: insert rectangle
shape, double click it ant write some text. Using inspector (Text tab)
you can choose between top, middle and bottom vertical alignment.

I am almost sure, that I need to subclass and overwrite some stuff
from either NSLayoutManager or NSATSTypesetter. Just not sure which
exact... Any thoughts?

Best Regards,

Rimas M.
___

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: Vertical alignment in NSTextView

2011-05-04 Thread Rimas M.
Hello Andrew,

Nope - that will not going to work, because container inset is expressed as
a size and inset is set equally from both sizes: inset.width for left and
right "margins", inset.height for top and bottom "margins".

But overwriting NSTextView's -(NSPoint)textContainerOrigin might do the
trick. Going to try that.

Regards,

Rimas M.

On Tue, May 3, 2011 at 7:05 PM, Andrew Glushchenko 
wrote:
> Hello, Rimas
> You can change the inset of the NSTextContainer associated with the
> NSTextView for this purpose. See setTextContainerInset method of
NSTextView.
> 2011/5/3 Rimas M. 
>>
>> Hello,
>>
>> I continue my fight with cocoa text system :)) At the moment I am
>> loosing..
>>
>> Now I am trying to implement vertical text alignment in NSTextView. If
>> I would need only drawing, would be quite easy. But I need to maintain
>> an editing capability.
>>
>> The thing I am talking about is very similar (or even the same) to the
>> text writing inside shape (rectangle) using Keynote: insert rectangle
>> shape, double click it ant write some text. Using inspector (Text tab)
>> you can choose between top, middle and bottom vertical alignment.
>>
>> I am almost sure, that I need to subclass and overwrite some stuff
>> from either NSLayoutManager or NSATSTypesetter. Just not sure which
>> exact... Any thoughts?
>>
>> Best Regards,
>>
>> Rimas M.
>> ___
>>
>> 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/nosetinker%40gmail.com
>>
>> This email sent to nosetin...@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: NSTextView and NSTextContainer size & clipping area

2011-05-09 Thread Rimas M.
As far as I remember, text container inset sets "margins" from both sides:
left and right and/or top and bottom. If text container position is
important according to the text view, this will not work.

2011/5/8 Kyle Sluder 

> On May 8, 2011, at 3:27 AM, Дмитрий Николаев 
> wrote:
>
> > Custom textview resize policy set, so it resizes in all dimensions with
> container. This is code for custom NSTextView
> >
> > -
> > - (void) setFrameSize:(NSSize)newSize {
> >
> >   [super setFrameSize:newSize];
> >
> >   NSTextContainer *container = [self textContainer];
> >   newSize.width -= 200;
> >   [container setContainerSize:newSize];
> > }
>
> Unrelated, by why aren't you just using -[NSTextView
> setTextContainerInset:] and letting the default width-tracking code do the
> work for 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: MobileMe API for uploading photos

2009-06-18 Thread Rimas M.
Hello,

Ok. It is possible to access iDisk itself - list content, create
folders, files etc. But I am wondering what to do, that MobileMe
gallery would show uploaded photos? How to create new album in this
gallery manually and upload photos to it?

Any help is appreciate.

Best Regards,

Rimas M.

On Mon, Mar 16, 2009 at 6:42 PM, Nick Zitzmann wrote:
>
> On Mar 15, 2009, at 10:32 PM, Deepa wrote:
>
>> Are there any APIs available for uploading photos to MobileMe account?
>
> There are, but you don't want to use them. Apple once made a DotMacKit
> framework that would upload anything to MobileMe, but it hasn't been updated
> in years, it's horribly obsolete, the authors will most likely never update
> it, and the source code isn't available.
>
> You're best off using a library that supports HTTP PUT and doing this
> manually, such as ConnectionKit or CURL.
___

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: MobileMe API for uploading photos

2009-06-18 Thread Rimas M.
Yes, I have followed your suggestion and I am using one of them to  
access iDisk. My question would be - what should I do, that my  
uploaded photos would be visible through http://gallery.me.com/ 
USERNAME. Or at least http://www.me.com/gallery/#home, when I am  
logged in. I am talking about things stored at /Web/Sites/_gallery/ 
xx/
I have tried to mimic structure created by iPhoto, but that does not  
work. There must be something that I am missing.


Basically, all I want to do, is to export photo from my app to  
MobileMe gallery, that would be accessible using web browser.


Regards,

Rimas M.


On 2009.06.18, at 18:03, Nick Zitzmann wrote:


On Jun 18, 2009, at 3:37 AM, Rimas M. wrote:



Ok. It is possible to access iDisk itself - list content, create
folders, files etc. But I am wondering what to do, that MobileMe
gallery would show uploaded photos? How to create new album in this
gallery manually and upload photos to it?



Use a WebDAV framework. Search around for one.


___

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


Transparent IKImageBrowserView

2010-07-23 Thread Rimas M.
Hello,

As far as I know, it is still impossible to have transparent
background of IKImageBrowserView?
I am writing to be 100% sure for that. Maybe I have missed something?

All my attempts to create transparent IKImageBrowserView failed.

I have tried:

* (1) setting background color for IKImageBrowserView as itself using
IKImageBrowserBackgroundColorKey. That works well until color alpha is
equal to 1.0. Bellow that color is ignored (color does not change) or
background is changed back to default white. Or... looks like given
color is composited on a white background.
* setting CALayer as IKImageBrowserView's backgroundLayer:
   ** (2) using property backgroundColor of CALayer. No background
transparency, scrolling ghosts, misc garbages during start-up - some
parts of menubar, other windows are visible for a few moments after
program launch.
   ** using custom drawing ( -
(void)drawInContext:(CGContextRef)context ) in CALayer subclass:
  *** (3) drawing transparent image to fill background. No
transparency for IKImageBrowserView, some strange ghosts while
scrolling.
  *** (4) filling background with transparent color (alpha < 1.0).
Behaves close to previous variant. "Size" of ghosts depends on alpha
value.

On 3 and 4, flushing context or telling it to clear visible rect makes no sense.

Best Regards,

Rimas M.
___

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: Transparent IKImageBrowserView

2010-07-26 Thread Rimas M.
My fault.

I was sure, that I have checked everything and nothing. I have made a
new empty Xcode project and that worked.
Finally I have found strange bug in my NSScrollView subclass. Fixed it
and looks like everything is OK now.

Thank you.

Best Regards,

Rimas M.

On Fri, Jul 23, 2010 at 4:39 PM, Steve Christensen  wrote:
> This worked for me:
>
> NSColor* browserBackgroundColor = [NSColor colorWithCalibratedWhite:0.10 
> alpha:0.60];
>
> [_effectsBrowser setValue:browserBackgroundColor 
> forKey:IKImageBrowserBackgroundColorKey];
>
>
> Are you sure that it's not working for you? Perhaps a superview has a 
> non-transparent background itself and that's what you're seeing?
>
>
> On Jul 23, 2010, at 12:04 AM, Rimas M. wrote:
>
>> Hello,
>>
>> As far as I know, it is still impossible to have transparent
>> background of IKImageBrowserView?
>> I am writing to be 100% sure for that. Maybe I have missed something?
>>
>> All my attempts to create transparent IKImageBrowserView failed.
>>
>> I have tried:
>>
>> * (1) setting background color for IKImageBrowserView as itself using
>> IKImageBrowserBackgroundColorKey. That works well until color alpha is
>> equal to 1.0. Bellow that color is ignored (color does not change) or
>> background is changed back to default white. Or... looks like given
>> color is composited on a white background.
>> * setting CALayer as IKImageBrowserView's backgroundLayer:
>>   ** (2) using property backgroundColor of CALayer. No background
>> transparency, scrolling ghosts, misc garbages during start-up - some
>> parts of menubar, other windows are visible for a few moments after
>> program launch.
>>   ** using custom drawing ( -
>> (void)drawInContext:(CGContextRef)context ) in CALayer subclass:
>>      *** (3) drawing transparent image to fill background. No
>> transparency for IKImageBrowserView, some strange ghosts while
>> scrolling.
>>      *** (4) filling background with transparent color (alpha < 1.0).
>> Behaves close to previous variant. "Size" of ghosts depends on alpha
>> value.
>>
>> On 3 and 4, flushing context or telling it to clear visible rect makes no 
>> sense.
>>
>> Best Regards,
>>
>> Rimas M.
>
>
___

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


Rotated and scaled CALayer

2010-10-21 Thread Rimas M.
Hello list,

I do not have a lot of practice with Core Animation, maybe that is the
reason. I have a real annoying problem.

All I want to do is:
1. Create CALayer
2. Set CGImage for its content
3. Depending on situation rotate and zoom in that layer (or its content)

Looks like everything works, but I am getting "rotated" pixels
(http://dl.dropbox.com/u/2030721/ForAppleList/Rotated%20Pixels.png).
That is not what I want. I would like to get rotated content of image
with "straight" pixels.

I was trying to play with layer transform property, with layer
delegate "- (void)drawLayer:(CALayer *)layer
inContext:(CGContextRef)ctx" and by using CGContextRotateCTM etc. I
have even tried to use layer and sublayer to split transforms (one
layer scales, and other rotates) but result is always the same.
Is there any way to achieve result I want? Currently the only way I know is:
a) to rotate an image by drawing it to the bitmap context
b) create new rotated CGImage from it
c) and then draw it for scaling.

But this way is quite slow. Is there a better one?

Any help is very appreciate.

Best Regards,

Rimas M.
___

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: Rotated and scaled CALayer

2010-12-07 Thread Rimas M.
Hello Andreas,

Thank you for detailed explanation.

However, I am not able to do what I want. Almost.

I have discovered, that if I use only CA layers transformations (via
setTransform:), I am getting the same rotated pixels when zooming in.
The only way, which does what I want is:
a) use core image filter to rotate layer (simple CIAffineTransform)
b) use second CI filter to tell renderer to use nearest interpolation
instead of linear.
c) use CA transformation to scale layer

Filter mentioned in b) does nothing. It only sets
kCISamplerFilterNearest for kCISamplerFilterMode of the input sampler.
And for c) I am using CATransform3DMakeScale.

Result is OK - when zooming in pixels remains unrotated. But new
problem occurs - when scrolling (even slowly) zoomed in layer, the
"pixels" flickers. And that causes filter of b). If I am not using it,
o its kCISamplerFilterMode setting to the kCISamplerFilterLinear,
flickering is gone. But zoomed pixels becomes rotated.

Rotated pixels:
http://dl.dropbox.com/u/2030721/ForAppleList/Rotated%20Pixels.png
Expected result:
http://dl.dropbox.com/u/2030721/ForAppleList/Non-rotated_pixels_when_zooming_in.png

Best Regards,

Rimas M.

p.s. I could provide sample application to demonstrate problem.

> - You should add your new layer as a sublayer to the layer of the 
> view-controller's view - or as a sublayer to any other layer than the 
> controller view's layer.
>
> - Usually, you "draw" the contents only once. However, when you set an 
> *image* via the layers's contents property, you don't need to explicitly draw 
> the layer - the layer draws the image for you, when it is required. So, just 
> set the image as the layer's contents.
>
> - You can scale/zoom the layers's contents by setting the layer's transform 
> property accordingly. This uses Core Animation, which executes - if possible 
> - on the GPU, and is therefore the fastest method. Note, this doesn't require 
> the image to be "drawn" again (it requires "rendering").
> You can create a suitable transform which scales AND zooms at once.
>
> - A CALayer's properties are "animatable" (see Core Animation). In fact, 
> changes in properties are animated by default. But you can define any 
> animation, and CA nicely performs them for you.
>
> - Using Core Graphics functions is *usually* not as fast as Core Animation 
> (if a CA alternative exists). But certainly, CG has its use. So, if you want 
> to scale and zoom interactively, use CA.
>
> Regarding transforms, see also:
> CATransform3DMakeRotation, CATransform3DMakeScale, CATransform3DConcat
>
>
> Regards,
>
> Andreas
___

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: Rotated and scaled CALayer

2010-12-13 Thread Rimas M.
Hello Vincent,

> Did you had a look at the vImage framework?
>
> Vincent

No I hadn't. I not quite sure which action (and how) I could use in
addition with Core Animation. I need (near) real-time drawing for
scaling and rotating. So dealing with pixels data for every update is
quite expensive. Unless I am missing something?

Regards,

Rimas M.
___

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


Shortcut handling in different keyboard layouts

2009-03-26 Thread Rimas M.
Hello,

I have a question about how properly keyboard shortcuts should be
handled. For example "pressing key X performs action W". How to ensure
that this will work with all keyboard layouts (Cyrillic etc)?
Currently I am checking key down event characters, but that is a wrong
way, because when layout is changed to Cyrillic that does not work. I
thought that would be great to use keyCode to check which action
should be performed. But then I remembered German keyboard layout - it
has Z and Y mixed. Keyboard button, which has label "Z" in US layout
produces keyCode 6, and button with label "Y" produces 16. In German
layout codes are the same, but labels swapped.
Take iTunes as example. With US layout enabled, pressing Cmd+Y calls
Preferences. Meanwhile to do the same in German layout you need to
press also Cmd+Y, but "Y" button is not the same as in US and produces
different code. I am wondering - how to check incoming key down events
to achieve that functionality. I am sure, that checking characters is
wrong way. Better would be to check keyCodes, but not perfect. Is
there a third way in Cocoa?
Help would be very appreciate.

Regards,

Rimas M.
___

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: Shortcut handling in different keyboard layouts

2009-03-27 Thread Rimas M.
> In general, using character codes is the most appropriate way. It lets the
> matching code automatically adapt to whatever the current keyboard layout
> may be. If you check the character code, it doesn't matter which physical
> key you've pressed.

Sounds interesting. I am gonna try this right now.

Rimas M.
___

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: Shortcut handling in different keyboard layouts

2009-03-27 Thread Rimas M.
> In general, using character codes is the most appropriate way. It lets the
> matching code automatically adapt to whatever the current keyboard layout
> may be. If you check the character code, it doesn't matter which physical
> key you've pressed.

Just to be sure - what character codes you are talking about? Do you
mean [[theEvent charactersIgnoringModifiers] characterAtIndex:0]
(which returns unichar) or something different?

Regards,

Rimas M.
___

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: Shortcut handling in different keyboard layouts

2009-03-31 Thread Rimas M.
On Tue, Mar 31, 2009 at 3:21 AM, Eric Schlegel  wrote:
>
> You probably want this: [[theEvent characters] characterAtIndex:0].
>
> -eric

The code above returns unichar - symbol (!) code 0-65535. While
keyboard layout is US for example, pressing "P" (lowercase, without
shift or any other modifiers) gives code 112 (ASCII lowercase 'p',
ASCII and Unicode 0-255 matches). Meanwhile after switching keyboard
layout to RU (Cyrillic), pressing the same key produces symbol "з" (I
am sure on www this symbol will not be displayed) with unichar code
1079. And that is the problem - what I need to do to ensure that
pressing "p" in US and "RU" keyboard layouts will do the same action
in my app.

Regards,

RImas M.
___

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: Shortcut handling in different keyboard layouts

2009-04-01 Thread Rimas M.
> In that case, you'd want to use the virtual keycode - available as [event
> keyCode] - rather than the character code. I thought when you'd posted your
> original question, though, you said that you wanted your keyboard event
> matching to be dependent on the keyboard layout, so that if you used, for
> example, a Dvorak keyboard layout, where the 'p' key is generated from the
> physical key that has an 'r' on it in the US layout, you'd still detect and
> match against that physical key. That's why I suggested using the character
> code rather than the keycode.
>
> -eric

You are right. If I would choose "keyCode way", there will be problems
with layouts like Dvorak.
I have an idea: Check if input character has code 0-255 (ASCII). If
yes - perform matching by symbol or its code. Otherwise (Unicode
symbol, like Cyrillic) perform matching by keyCode. I am wondering if
it will work in right way...

Regards,

Rimas M.
___

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: Shortcut handling in different keyboard layouts

2009-04-01 Thread Rimas M.
> Matching on keycode will almost always confuse your users.
>
> There are at least 9 different Cyrillic keyboard layouts supported by OS X.
> If you write code that matches the virtual keycode for 2nd rank 11th key, it
> will match "з" (ze) for half or those layouts and "п" (pe) for the other
> half. Your users are not going to count off ranks and keys, they will be
> looking for a Cyrillic character. Half of them will hit a different key from
> what you're expecting.
>
> If Cyrillic keyboards are likely to be a part of your user base, you would
> probably be better advised to set up a mapping table for Cyrillic
> characters. Either map the Cyrillic alphabet to the Latin alphabet and from
> thence to your keyboard commands or, better still, map the Cyrillic alphabet
> directly to the keyboard-triggered commands.
>
> As pointed out earlier, the OS handles this automagically for Cmd-key
> combinations. You can see this for yourself by turning on a couple of
> relevant keyboard layouts in System Preferences->International->Input Menu,
> selecting one of them and turning on the Keyboard Viewer (at the bottom of
> the Input Menu). While the Command key is depressed, the layout reverts to
> US Sholes.
>
> I have used a few applications that implemented keyboard shortcuts beyond
> Command-key combinations. Those that implemented keyboard-command mappings
> based on an assumed physical location of characters have always left
> international users confused and disatisfied.
>
> My EURO 0.02 -- Peter

Thanks for your 0.02 Peter :)

Currently I am a bit confused. I am not sure which way is best for
users. The best example for I am talking about is Photoshop tools
switching via keyboard. I doubt it uses (or maybe?) Cyrillic
characters mapping. Because if you want to switch to Pencil tool, you
need to press "P" labeled keyboard button in US layout. Even more, you
must press the same button on RU layout. But that button produces "з".
I am not talking about command-key -> actions. I want to implement key
-> action in the correct way. I am quite sure, that such company as
Adobe and long-time project as Photoshop would do that in right way.
Maybe I am wrong. For this reason I am writing here.

Regards,

Rimas M.
___

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