Page 1 of 1

represented filename

Posted: Fri Oct 09, 2015 9:21 pm
by monte
Hi

I was wondering about adding a window decoration or other property to allow NSWindow setRepresentedFilename to work. Originally I thought we might need to have a separate path saved for the stack but then I realised it's not that tricky to fiddle with there stack filename on the fly so it points at some underlying data source file. So a decoration flag will cover it.

Any thoughts or should I just go ahead and submit a PR?

Cheers

Monte

Re: represented filename

Posted: Sat Oct 10, 2015 2:05 pm
by LCMark
@monte: I presume this would add the little 'document' icon next to the title bar text?

I'd suggest making it a transient 'documentFilename' property - after all, a stack might be an editor for a file in an application and as such would have no relation to the stack filename. Indeed, if the stack is created on the fly, it wouldn't have a filename at all.

If the documentFIlename is empty, then no icon is shown; otherwise one representing the specified filename would be.

Re: represented filename

Posted: Sat Oct 10, 2015 9:37 pm
by monte
Yes, that's it the icon in the title.

I was thinking that if the stack were created on the fly then you could still set the filename. It doesn't worry me either way but I think some users use ui stacks as the saved file and using the standard filename and a decoration would make the behavior automatic once the file is saved in those cases while for those that clone a template stack or just create one on the fly it's just a matter of setting the filename.

Like I said I'm happy either way so whatever you want. I'm also unsure if there's a similar feature on Windows or Linux so I'll research that.

Re: represented filename

Posted: Sun Oct 11, 2015 9:43 am
by LCMark
The two main use-cases I think are this:

Someone writes a stack which allows you to edit a file of some sort. It is a single-document editor, so the actually editor stack always hosts the file. In this instance, the filename of the document is distinct from that of the stack (indeed, the stack might use its filename to find resources). This would require a distinct property.

Someone writes a multi-view editor which works by replication of a template stack. Now, in this case the editor stacks would never be saved so whilst the 'filename' property of them might be something which could be used for the actual document filename it mixes up two things. Particularly if you think about editing in the IDE - if you accidentally save one of your replicated editors whilst debugging the editing of a specific file, you'd end up overwriting your test document file by accident.

Having an explicitly separate property to control the document filename is definitely going to be the much more common case, and something which will avoid any accidents whilst editing in the IDE.

Re: represented filename

Posted: Sun Oct 11, 2015 11:43 am
by monte
OK, no problem, probably simpler to implement anyway. Particularly if it's just a transient property as you suggested earlier.

Re: represented filename

Posted: Mon Oct 12, 2015 12:45 am
by monte