NSSplitView strange behavior

2013-08-13 Thread Vincent CARLIER
Hi list,

I experience some strange behavior with NSSplitView.

Let me explain what I'm trying to do :

The split view contains 3 subviews (2 dividers), and has a delegate that
controls it. It is an horizontal split view.
Let number those 3 views from top to bottom 0, 1 and 2.

The upper divider has the default behavior, the two upper views (0  1)
should be resized.
I want the lower divider to behave differently, when dragged, view 1 should
not resize but instead views 0  2 should.

So, to achieve this, I implemented delegate methods :

-(void)splitViewDidResizeSubviews:(NSNotification *)notif;
-(void)splitViewWillResizeSubviews:(NSNotification *)notif;

In those methods, I inspect the userInfo dictionary, in order to react only
when the divider n°1 is dragged.

In the first method, I record the position of divider 0, as well as the
height of the third view :

_positionZero = NSHeight([view0 frame]);
_view2Height = NSHeight([view2 frame]);

In the second, I compute the difference between view2 successive heights,
and then move divider 0 by the same amount :

CGFloat view2HeightDelta = _view2Height - NSHeight([view2 frame]);
[[self splitView] setPosition:(_positionZero + view2Height)
ofDividerAtIndex:0]; // view2Height maybe positive or negative

Now, what happens ?

When I drag divider 1 down, all works as expected.
When I drag it up, it stops moving at what appears to be the return value
of -minPossiblePositionOfDividerAtIndex, for divider 0.

This shouldn't happen, as the min possible position is updated after the
call to -setPosition:ofDividerAtIndex:, which is confirmed by my logs.
But the divider stops moving at this limit, as if the split view was
looking only one time to this minimum, and never again (until I release the
mouse and then drag the divider again).

Anyone experienced something like this ?
Is there a better way to do what I'm trying to do ?

Any answer/advice is greatly appreciated.

Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Document Window Versions Drop-down Menu

2013-05-15 Thread Vincent CARLIER
Hi Kyle,

2013/5/14 Kyle Sluder k...@ksluder.com

 On May 14, 2013, at 1:33 AM, Vincent CARLIER vince.carl...@gmail.com
 wrote:

  No matter what I do, only the first window (that is the window managed by
  the first WC created for the document) gets the menu.

 What does the secondary window return for -isExcludedFromWindowsMenu?


Windows all answer 'NO' to that message, and of course all window titles
appear in the menu.


 It's possible that NSDocument automatically turns that on for windows
 owned by secondary window controllers.


NSWindow class reference tells that the default is NO for a window.
Didn't you confuse windows menu with versions menu ? I'm really talking
about the drop down menu, next to the window title.
I did look for a method called -isExcludedFromVersionsMenu, or something
like that, and found nothing.

It seems Versions is some kind of opaque feature.


 --Kyle Sluder


Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Document Window Versions Drop-down Menu

2013-05-15 Thread Vincent CARLIER
Re Quincey,

2013/5/14 Quincey Morris quinceymor...@rivergatesoftware.com

 On May 14, 2013, at 04:30 , Vincent CARLIER vince.carl...@gmail.com
 wrote:

 As you will see, the menu item opens a second (and any number) of windows
 for the document, but only the first has got the menu.


 Yes, now you've pointed this out, I can see the same (mis)behavior in my
 own apps. Whether it used to work and now doesn't, I can't recall.

 But it does look like a bug.


To me it does too.
So I did report a bug to Apple (#13896792).



Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Document Window Versions Drop-down Menu

2013-05-14 Thread Vincent CARLIER
Hi all,

I'm writing a document based app. Each document is displayed in a window,
and can have several other windows too.
The primary window and the others are the same (same NIB, same window
controller), each window is able to display a different part of the
document data.

At the beginning, only a single window is opened, and the user can request
other windows to display the document via a menu item.

So now, when the first window is opened, it has a drop down menu in its
title bar, to let the user Rename, Duplicate, etc..., the document.

What happen is if a second window (and subsequent ones) is opened, it
doesn't have this menu.
I thought every window would get that menu, after all each one is tied to
the document.

More important, if the first opened window (the one with the menu) is
closed, the menu is just lost. The user user is still able to act on the
document via the File menu, though.

So my question is :

Is there a way to put the menu on other windows too, is there any available
API to do that ? (I didn't find anything related in the documentation, and
googling that didn't produce any result)
Or maybe it is the right behavior, the first window get the menu, and other
windows are considered secondary windows and don't get it ? (the
documentation refers to my situation as multiple-view document, and
suggests that it's right to open several windows for the same document).

Anybody can provide feedback on that ?

Thank you for your answers.

Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Document Window Versions Drop-down Menu

2013-05-14 Thread Vincent CARLIER
Hi Quincey,

thank you for the quick answer.
Unfortunately, no, I didn't forget to add the window controllers using the
method you mention.

At document creation/opening, a first WC is created (I mean alloc/init),
added to the document, and released.

As the user request additional windows, the same path is taken, a new WC is
created, added to the document, and finally receive a showWindow: message,
that I send to it directly :

-(IBAction)openDocumentInNewWindow:(id)sender {
AMDocumentWindowController *dwc = [[AMDocumentWindowController alloc]
init];
[[self document] addWindowController:gpdwc];
[gpdwc release];
[gpdwc showWindow:self];
}

This method is defined in the primary WC controller class.

No matter what I do, only the first window (that is the window managed by
the first WC created for the document) gets the menu.
This is true (at least for me ;) even if subsequent WC aren't the same
class, and windows are totally different.

I don't know if it makes any difference, I'm running Mac OS X Mountain Lion
10.8.3, Xcode 4.6.2.

Vince.


2013/5/14 Quincey Morris quinceymor...@rivergatesoftware.com

 On May 14, 2013, at 00:07 , Vincent CARLIER vince.carl...@gmail.com
 wrote:

 Is there a way to put the menu on other windows too, is there any available
 API to do that ?


 All document windows should have the menu. My guess is that you forgot to
 invoke '-[NSDocument addWindowController:]' on the additional window
 controllers.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Document Window Versions Drop-down Menu

2013-05-14 Thread Vincent CARLIER
-(IBAction)openDocumentInNewWindow:(id)sender {
AMDocumentWindowController *dwc = [[AMDocumentWindowController alloc]
init];
[[self document] addWindowController:gpdwc];
[gpdwc release];
[gpdwc showWindow:self];
}

Typo here, WC reference name is dwc, not gpdwc. Sorry.


2013/5/14 Vincent CARLIER vince.carl...@gmail.com

 Hi Quincey,

 thank you for the quick answer.
 Unfortunately, no, I didn't forget to add the window controllers using the
 method you mention.

 At document creation/opening, a first WC is created (I mean alloc/init),
 added to the document, and released.

 As the user request additional windows, the same path is taken, a new WC
 is created, added to the document, and finally receive a showWindow:
 message, that I send to it directly :

 -(IBAction)openDocumentInNewWindow:(id)sender {
 AMDocumentWindowController *dwc = [[AMDocumentWindowController alloc]
 init];
 [[self document] addWindowController:gpdwc];
 [gpdwc release];
 [gpdwc showWindow:self];
 }

 This method is defined in the primary WC controller class.

 No matter what I do, only the first window (that is the window managed by
 the first WC created for the document) gets the menu.
 This is true (at least for me ;) even if subsequent WC aren't the same
 class, and windows are totally different.

 I don't know if it makes any difference, I'm running Mac OS X Mountain
 Lion 10.8.3, Xcode 4.6.2.

 Vince.


 2013/5/14 Quincey Morris quinceymor...@rivergatesoftware.com

 On May 14, 2013, at 00:07 , Vincent CARLIER vince.carl...@gmail.com
 wrote:

 Is there a way to put the menu on other windows too, is there any
 available
 API to do that ?


 All document windows should have the menu. My guess is that you forgot to
 invoke '-[NSDocument addWindowController:]' on the additional window
 controllers.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Sandboxed app record-level indexing of Core Data in Spotlight (not working)

2013-05-14 Thread Vincent CARLIER
Date: Tue, 14 May 2013 12:07:02 +0200
 From: Giacomo Tufano g...@iltofa.com
 To: cocoa-dev@lists.apple.com
 Subject: Sandboxed app  record-level indexing of Core Data in
 Spotlight (not  working)
 Message-ID: 127dc0cb-c922-435c-adba-e873e8593...@iltofa.com
 Content-Type: text/plain; charset=us-ascii

 I'm trying to create a spotlight importer for a core data application,
 using the record level indexing as descripted in the Core Data Spotlight
 Integration Programming Guide.

 I have a working .mdimporter that works correctly if I copy the importer
 in /Library/Spotlight (it will index and spotlight find the documents).
 The problem is that the embedded importer in the application (I started
 with the Xcode template for use core data and create importer is never
 called by the system. I checked that the .mdimporter is in the app bundle
 inside the Contents/Resources/APPNAMEImported.mdimporter directory.
 I'm planning to use MAS, so I *think* I cannot move anything in
 /Library/Spotlight.

 I religiously read the guide many times (and especially the
 troubleshooting section) but, you know, the more you read, the same it
 seems. :) Any hint on what to look for will be appreciated, I'm out of
 ideas.

 I strongly suspect that the problem is related to the sandboxing of the
 app, because the Guide seems to not consider sandbox. For example, I had to
 find by trial and error that the the NSExternalRecordsDirectoryOption for
 the persistent store is a tricky one for sandboxed app, at the end I use
 NSLibraryDirectory/CoreData/LocalConfig/ but the runtime raised exception
 for almost any other one, included the recommended (by the exception in
 itself) ~/Library/Caches/Metadata/CoreData (sandbox error) or
 NSCacheDirectory/Metadata/CoreData (error 'should be
 ~/Library/Caches/Metadata/CoreData').

 If some code is needed to troubleshoot, just ask (I really have no idea of
 what could be useful and not simply noise).

 Thank you in advance,
 gt


Hi gt,

If your importer is bundled into your app, it should be in :

Appname.app/Contents/Library/Spotlight

Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Document Window Versions Drop-down Menu

2013-05-14 Thread Vincent CARLIER
To illustrate the issue, I created a simple test project that you can clone
from Bitbucket : https://bitbucket.org/vincedev/tesdocapp.git

As you will see, the menu item opens a second (and any number) of windows
for the document, but only the first has got the menu.

Vince.


2013/5/14 Vincent CARLIER vince.carl...@gmail.com

 -(IBAction)openDocumentInNewWindow:(id)sender {
 AMDocumentWindowController *dwc = [[AMDocumentWindowController alloc]
 init];
 [[self document] addWindowController:gpdwc];
 [gpdwc release];
 [gpdwc showWindow:self];
 }

 Typo here, WC reference name is dwc, not gpdwc. Sorry.


 2013/5/14 Vincent CARLIER vince.carl...@gmail.com

 Hi Quincey,

 thank you for the quick answer.
 Unfortunately, no, I didn't forget to add the window controllers using
 the method you mention.

 At document creation/opening, a first WC is created (I mean alloc/init),
 added to the document, and released.

 As the user request additional windows, the same path is taken, a new WC
 is created, added to the document, and finally receive a showWindow:
 message, that I send to it directly :

 -(IBAction)openDocumentInNewWindow:(id)sender {
 AMDocumentWindowController *dwc = [[AMDocumentWindowController alloc]
 init];
 [[self document] addWindowController:gpdwc];
 [gpdwc release];
 [gpdwc showWindow:self];
 }

 This method is defined in the primary WC controller class.

 No matter what I do, only the first window (that is the window managed by
 the first WC created for the document) gets the menu.
 This is true (at least for me ;) even if subsequent WC aren't the same
 class, and windows are totally different.

 I don't know if it makes any difference, I'm running Mac OS X Mountain
 Lion 10.8.3, Xcode 4.6.2.

 Vince.


 2013/5/14 Quincey Morris quinceymor...@rivergatesoftware.com

 On May 14, 2013, at 00:07 , Vincent CARLIER vince.carl...@gmail.com
 wrote:

 Is there a way to put the menu on other windows too, is there any
 available
 API to do that ?


 All document windows should have the menu. My guess is that you forgot
 to invoke '-[NSDocument addWindowController:]' on the additional window
 controllers.




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Sandboxed app record-level indexing of Core Data in Spotlight (not working)

2013-05-14 Thread Vincent CARLIER
Re gt,

2013/5/14 Giacomo Tufano g...@iltofa.com

 Il giorno 14/mag/2013, alle ore 13:00, Vincent CARLIER 
 vince.carl...@gmail.com ha scritto:

 I have a working .mdimporter that works correctly if I copy the importer
 in /Library/Spotlight (it will index and spotlight find the documents).
 The problem is that the embedded importer in the application (I started
 with the Xcode template for use core data and create importer is never
 called by the system. I checked that the .mdimporter is in the app bundle
 inside the Contents/Resources/APPNAMEImported.mdimporter directory.
 I'm planning to use MAS, so I *think* I cannot move anything in
 /Library/Spotlight.


 If your importer is bundled into your app, it should be in :
 Appname.app/Contents/Library/Spotlight


 Thank you Vincent! In Contents/Library/Spotlight works. I'm wondering
 where's documented, but it's OK (my fault, probably).


It's documented in the section Troubleshooting Spotlight Importers, in
Spotlight Importer Programming Guide :

An application’s Spotlight importer resides within the application’s
bundle in the subdirectory MyApp.app/Contents/Library/Spotlight. (top of
the page).


 I now get errors (one for every file) in mdworker (apparently from
 sandboxing) stating:
 14/05/13 13:24:43,007 sandboxd[29551]: ([29550]) mdworker(29550) deny
 file-write-create 
 /Users/gt/Library/Containers/it.iltofa.Janus/Data/Documents/SharedCoreDataStores/.localStore_SUPPORT/.LINKS
 (import fstype:hfs fsflag:480D000 flags:24005F diag:0
 uti:it.iltofa.janus
 plugin:/Janus.app/Contents/Library/Spotlight/JanusImporter.mdimporter -
 find suspect file using: sudo mdutil -t 17981324)
 but it seems to work (records are indexed spotlight find them, etc. (now
 I'll try to understand what else is wrong).


Sounds like a permission problem, I never had such a problem though.


 Beside that, I'll have to understand how to convince Xcode to copy the
 .mdimporter in Library/Spotlight automatically (but this seems easier).


Add a copy files phase in the Build Phases for the app target, select the
Wrapper item in the popup button and add the subpath to the directory in
the field below.


 Thank you *very* much,
 gt

 btw: a test project just created with Xcode 4.6.2 cocoa app template
 generates an .mdimporter bundled under Resources. Should I file a bug or
 this is expected?


Not sure it is expected, as the documentation tells to put the importer in
another directory. I imagine Xcode defaults to the Resources directory when
it has to copy things.

Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Writing a custom Spotlight Importer

2013-05-09 Thread Vincent CARLIER
Hello everybody,

I've written a Spotlight Importer for my custom document format. The
document has an UTI, used by the Spotlight Importer.

Everything is fine, I can see my Metadata Fields correctly indexed by
Spotlight, I can see the right importer loaded (it is bundled into the
.app) when I run `mdimport -L`, except the Finder doesn't display the
fields I've said it to display.

Here is what the schema.xml file look like :

   ?xml version=1.0 encoding=UTF-8?

   schema version=1.0
   xmlns=http://www.apple.com/metadata;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=
http://www.apple.com/metadatafile:///System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/MetadataSchema.xsd

   attributes
   attribute name=com_myDomain_myApp_myDocument_test
multivalued=false type=CFString /
   /attributes
   types
   type name=com.myDomain.myapp.mydocument
   allattrs
   kMDItemTitle
   kMDItemAuthors
   kMDItemAlbum
   com_myDomain_myApp_myDocument_test
   /allattrs
   displayattrs
   kMDItemTitle
   kMDItemAuthors
   kMDItemAlbum
   com_myDomain_myApp_myDocument_test
   /displayattrs
   /type
   /types
/schema

I wasn't able to validate this file syntax (but it seems right), my system
is lacking the `mdcheckschema` command, and I can't find it anywhere. Also
I thought that fields appearing in the `displayattrs` would have been
displayed by the Finder's Get Info pane.

The `schema.xml` file appears at the right place into the mdimporter
bundle. This is really annoying, since I use already defined fields, and
only one custom field. Apple's documentation doesn't tell anything on this
situation and I wasn't able to find an answer to my problem.

Does anybody know what to do to have those informations displayed by the
Finder's More Info section ?
Maybe someone can provide useful tips ?

Vince.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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