The mind mapping system now works via a set of minibuffer commands.  You 
can put an indented list into a node and display it as a mind map.  Or you 
can display an entire subtree as a mind map.

I have worked out a set of three scripts that together make this mind 
mapping system work.  One script, the one that does all the calculations  
and layout, generates the svg for the mind map diagram.  If it has not been 
run already in the current Leo session, it monkey patches the map building 
function to the outline commander when run so the other two scripts can 
call it.  This script also saves the svg output to a node and opens a 
rendering pane to display it.  It's about 1000 LOC long.  It's the longest 
script I have written that can be run with a simple CTRL-B (though that is 
not how it would normally be run).

The user does not have to actually run this script because the two other 
commands run it when needed.  One of these scripts takes an indented list 
in the selected node and feeds it to the monkey-patched script.  The other 
one converts a tree starting at the selected node to an indented list and 
then feeds it to the monkey-patched script.

The scripts copy the svg output into a node in the outline.  This node can 
have a name you specify in a setting, or a default.  If the node does not 
exist, it is created first.  The focus and selection are changed to this 
node.

The script then opens the svg diagram in a "rendering device".  This can be 
one of Viewrendered3, Freewin, or the system browser.  By default it is 
VR3.  The rendering device is specified by a setting.  I like to use 
Freewin because it can be made larger than the VR3 pane usually is, and you 
can have several different mind maps open at once if you like. The mind map 
also stays open when you switch away from the svg output node, unlike the 
case for VR3.  The latest version of Freewin renders the svg as a diagram.

The layout is a little simple minded in this version.  The branches get 
placed around the central image clockwise starting at 1:00, which is how I 
usually like to do it.  If there are only a few small branches, though, 
this produces a somewhat lopsided diagram.  I might work on improving this 
in the future.  The label locations could use a little tweaking, and if the 
label of the central image is very long, it might obscure part of some 
nearby branch labels.  But then it's best not to use very long headlines 
for your nodes anyway ...

As I wrote earlier, these mind maps include up to two branching levels.  I 
think that the diagrams become too cluttered, with labels too tiny to read, 
if there are more than two levels.  Now a hand-drawn map, maybe drawn on 
larger paper, is a different story.  And a map rendered on a separate large 
monitor might work well enough with three levels.  But for ordinary single 
monitor use, with a window that does not take up the entire screen, more 
than two levels doesn't work well IMHO.

I will issue a pull request to put these scripts into *scripts.leo*, and 
will post here when the PR has been accepted.

On Sunday, August 1, 2021 at 11:34:24 AM UTC-4 [email protected] wrote:

> The layout code now can lay out branches on both sides of the screen.  
> I've attached a pair of screen shots.  It will also add a message if there 
> are more branches than can be fit on the screen, so you know the mind map 
> is not complete.
>
> I'm working on some ideas about how to make a user interface work.  One 
> goal is to avoid having to make it into a plugin.  OTOH, maybe that would 
> be acceptable even if it would add complication.  If it's not a plugin, 
> there doesn't seem to be an easy-to-find home for scripts that aren't 
> plugins.  I know there is such a thing, but I never remember where it is or 
> what it is called.  Would that be *scripts.leo*?  I never think to look 
> there - I should start to check it out.
>
> Please give me some feedback about whether it would be better having the 
> code as a plugin vs a script!
>
> On Wednesday, July 21, 2021 at 7:53:29 PM UTC-4 [email protected] wrote:
>
>> Oh, good.  The next step is for me to finish laying out branches in the 6 
>> - 12 PM half of the screen.  After that, the interface - how to run it and 
>> get the output to display.  Currently I have pre-parsed parts of a Leo 
>> outline, capture the output in the clipboard, paste it into a node, and 
>> view that node with VR3.  Awkward, but handy for development.
>>
>> The mind map layout engine includes a little parser that can take any 
>> indented list and produce a mind map.  It's another UI thing to work out 
>> how to make that functionality easy to use.  But first, I will be finishing 
>> the layout code.
>>
>> On Wednesday, July 21, 2021 at 6:13:17 PM UTC-4 Rob wrote:
>>
>>> This is very interesting and I would love to see what you come up with.
>>>
>>> Rob...
>>>
>>> On Tuesday, July 13, 2021 at 12:34:14 AM UTC-4 [email protected] wrote:
>>>
>>>> I've been working on displaying Leo outlines as mind maps, in the hopes 
>>>> that this would be useful, or at least entertaining.  I've gotten the work 
>>>> almost to the point where it could be useful.  
>>>>
>>>> There are a lot of design decisions to make for a project like this, 
>>>> and one of them is that I will only display up to two levels deep.  I have 
>>>> learned over the years that more than this becomes too hard to read on a 
>>>> computer screen.  Of course, on paper you use more levels, especially if 
>>>> you draw on bigger paper, or have smaller handwriting than I do.
>>>>
>>>> Automatic layout is not easy, but what I have is getting close to being 
>>>> acceptable.  Right now it only lays out the nodes on one side of the 
>>>> central image.  I will be extending them to both sides soon.  You can only 
>>>> show so many in a browser window, so I stop painting them when they would 
>>>> overflow off the screen.
>>>>
>>>> The mind maps are constructed with SVG, and any modern browser can 
>>>> display SVG.  That makes the (python) code itself a code generator - a 
>>>> venerable endeavor.  As a side benefit, the parser can turn any 
>>>> single-rooted indented list into a mind map.  In fact, when the code walks 
>>>> a tree in a Leo outline, it turns the tree into an indented list and 
>>>> parses 
>>>> that to feed the map construction machinery.
>>>>
>>>> The attached image is of actual output of the system, showing a part of 
>>>> the outline for the ViewRendered3 plugin.
>>>>
>>>> Please post any thoughts, reactions, or suggestions you have! 
>>>> Eventually, the thing will probably go into a plugin.  I'm not clear yet 
>>>> whether it will work best as part of VR3, Freewin, or if it should be in a 
>>>> plugin of its own.  Or maybe it can be incorporated into Leo without 
>>>> needing a plugin.  Please let me know your thoughts about this, and about 
>>>> how a user interface for it might work.
>>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/bc12b827-af00-489d-bed2-df9d18c309a9n%40googlegroups.com.

Reply via email to