On Wed, May 27, 2020 at 2:08 PM Thomas Passin <tbp100...@gmail.com> wrote:

> I'm liking this proposal.  My (limited) experience with writing commands
is that at first, I only expect to use them within the one outline file I'm
working on. The commands and shortcuts would live in the settings tree of
that outline.

When I awoke this morning, I saw that my proposal could collapse further,
as follows:

1. We only need a single command, say *duplicate-template*, that can be
applied to *any* node. This command will do the following:

- Write the selected node (including all descendants) to a string s, *in
clipboard format*. See the next section for details.
- Call c.outlineCommands.pasteOutlineRetainingClones(s) to do
paste-retaining clones.

2. You can apply duplicate-template applies to any node. This means that
you can put templates anywhere, and there is no need for explicit support
for @template <command-name>.

3. To transfer a node that you *use* as a template to another file, just
copy the template and then do paste-retaining clones.  After that, you can
adjust which nodes you want to be cloned. Clear?

*Reassigning gnx's*

The write code *won't *be easier said than done, because it won't have to
change vnodes *after* the vnodes have been created. Instead, the write code
only needs to create a clipboard-formatted string with the desired gnx's.

Leo's copy-node command just calls fc.putLeoOutline. The duplicate-template
command will *temporarily* reassign gnx's before calling fc.putLeoOutline
and then restore the original gnx's afterward.

Finally, the duplicate-command will do the paste-retaining clones,
with the *already
correct* gnxs. No change at all to the paste-retaining-clones code will be
necessary.

*Summary*

A single command, *duplicate-template*, should suffice. This command will
copy c.p as a template, and paste the resulting copy after c.p.

The command's write code is the heart of this command. The write code will
copy c.p to a string, in clipboard format, as with the copy-node command.
Unlike the copy-node command, the write code will *temporarily allocate *new
gnx's to all nodes that are neither clones nor descendants of a clone.

All comments and questions are welcome.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS38Nui2WQo7EoC0rupJ4BcUXdX_Fzc4Bqka%3DCk6968u_A%40mail.gmail.com.

Reply via email to