Scripting Tree text editing

18 views
Skip to first unread message

ch rr

unread,
Jan 1, 2024, 7:04:18 PMJan 1
to Notecase Pro

Hi,

As a new user of Notecase Pro, I congratulate all involved in making this fine piece of software.

That being said, may I now say I'd like to change something in it? ;)

I intend to use it as a single-pane outliner, meaning "the titles are the content".

So far, I miss two things while I'm in the zone with the outline (I'll use the word "Item" for what I consider a "Note" but is actually a "Title" in Notecase Pro parlance):

a) writing Items directly "on the line" in the tree pane (i.e. not by going through the "Note Properties" dialog box). The same goes for editing existing Items in the tree (i.e. not using "rename" and the Properties box): key combo to get into "text edit mode", Esc to exit.

b) truly splitting an Item in the tree by simply hitting a key combination: the caret defines the split position, the left part of the text doesn't change and the Item just stays there, only shorter, no change of level of indentation, and the right part of the text is made into a new sibling Item on a line inserted right between the shortened original Item and any existing next line (or inserted at the bottom of the tree if we're splitting the last line, of course).

Could I do this with a Lua script? Would it require a plugin? Undos possible? I'm conscious it might mean updating things related to GTK and other constraints and complexities which I don't know yet, so I don't have any idea of the amount of work required. Not screwing things up in the Note Pane or the List View could be beyond the means of the API and Lua, I don't know that yet either (the API is not available during the test period, right?). I could give up on some Note Pane functionality not directly related to the tree and to file exchange (I'll go for the two-Windows one-macOS license, and probably Android).

Ciao,

Chris

info.sim...@googlemail.com

unread,
Jan 14, 2024, 4:19:04 AMJan 14
to Notecase Pro
Hi Chris,

there is no way of editing the tree directly. However, using shortcuts makes it simple. Instead of contect menu "Note rename" just hit F2 (I am on Windows and Linux - not sure this works on mac). Inserting a note you can simple use the INS key.

regarding splitting the tree you should play with the hoist feature to see whether this gives you the result you are looking for. Just select an item in the tree and in the context menu go to Tree-Hoisting-Hoist Branch

kind regards

Raimund

Paul Merrell

unread,
Jan 14, 2024, 8:51:41 AMJan 14
to noteca...@googlegroups.com

chr...@gmail.com schrieb am Dienstag, 2. Januar 2024 um 01:04:18 UTC+1:

So far, I miss two things while I'm in the zone with the outline (I'll use the word "Item" for what I consider a "Note" but is actually a "Title" in Notecase Pro parlance):

In NC Pro parlance, "note" means the content of the Note Pane except when referring to the entire node. 
 
a) writing Items directly "on the line" in the tree pane (i.e. not by going through the "Note Properties" dialog box). The same goes for editing existing Items in the tree (i.e. not using "rename" and the Properties box): key combo to get into "text edit mode", Esc to exit.

I don't think this is possible given the program's current design. Hit Ctrl+T to cycle through the available views.  

b) truly splitting an Item in the tree by simply hitting a key combination: the caret defines the split position, the left part of the text doesn't change and the Item just stays there, only shorter, no change of level of indentation, and the right part of the text is made into a new sibling Item on a line inserted right between the shortened original Item and any existing next line (or inserted at the bottom of the tree if we're splitting the last line, of course).

Check the Split Note function on the Edit > Actions menu.  See Help file > User Interface > Menus > Main Menus > Edit Menu > Actions > Split Note. You can add this action to a toolbar item or keyboard shortcut. 
 
Could I do this with a Lua script? Would it require a plugin? Undos possible? I'm conscious it might mean updating things related to GTK and other constraints and complexities which I don't know yet, so I don't have any idea of the amount of work required. Not screwing things up in the Note Pane or the List View could be beyond the means of the API and Lua, I don't know that yet either (the API is not available during the test period, right?). I could give up on some Note Pane functionality not directly related to the tree and to file exchange (I'll go for the two-Windows one-macOS license, and probably Android).

It's possible to split a note from a script that's either stand-alone or in a plugin. See Help file > Automation, Scripts and Plugins > Scripting NoteCase Pro > Scriptable Program Commands > Application Commands > Nc_App_Action_Execute with the "tree_note_split" action name. 

However, there's not much present ability to do much useful by using it, because there is no return of the note IDs for the newly created notes and because they are siblings of the original note that can't reliably be predicted. One could, I suppose, create a table of all existing notes before splitting a note and after, then process the two tables to determine which are new. But that's very cumbersome. I'd much prefer to persuade Miro to create a special API method to split a note that returns the note IDs of the newly created notes. (I'd like that method to include a parameter that can block the repetition of the new note title at the top of the note.) 

If you want to create such a script, you might find some of the code useful in the attached script, Selected Laundry List to Notes. 

Best regards,

Paul Merrell  
 
Tmp.ncdb

Miroslav Rajcic

unread,
Jan 14, 2024, 10:38:30 AMJan 14
to Notecase Pro
Hi Chris,

somehow I missed this mail, probably got in my spam folder.
Few comments:
  1. if I remember correctly (this project is not 20 years old), it was implemented initially, but it had issues with some niche-platforms we supported at a time, like Maemo or Sharp Zaurus (can not remember correctly) so it got removed. I can add  tis to to-do list
  2. splitting the item into two (actually creating new one) with a shortcut while editing its title in Tree Pane is not possible with Lua because there is no support for a) and so there is no Lua API to tell you caret position while you edit the title. If a) gets implemented, this can be done too.

Regards,
Miro


From: 'info.sim...@googlemail.com' via Notecase Pro <noteca...@googlegroups.com>
Sent: Sunday, January 14, 2024 10:19 AM
To: Notecase Pro <noteca...@googlegroups.com>
Subject: Re: Scripting Tree text editing
 
--
You received this message because you are subscribed to the Google Groups "Notecase Pro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notecase-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/notecase-pro/ea131684-fbcc-4e00-94df-a8a76fa16d80n%40googlegroups.com.

Virus-free.www.avast.com
Reply all
Reply to author
Forward
0 new messages