Skip to content
Angelo Geels edited this page Feb 25, 2015 · 3 revisions

init

Called when the addon gets enabled. This is either on startup of the program, or when the user approves the permissions and enables the addon from the settings.

Parameters:

uninit

Called when the addon gets disabled. This is either when the program closes, or when the user disables it in the settings.

loadsettings

Called after all Nimble Writer settings have been loaded. This only gets called on program startup, not when a user enables the addon manually in the settings.

Parameters:

addonsmenu

Called when the user clicks on the Addons button. This will open a menu, which you can add your own items to. You can add separators as needed (add an item with "-" as value).

Parameters:

  • MenuItemsCollection menuItems The list of menu items you should add items to.

switchchapter

Called when the user switches to a different chapter, or when the system has to switch to a different chapter automatically. (Such a thing happens in some cases during export, which is a temporary "bug" for now.)

Parameters:

  • int iChapter The chapter index that has been switched to.
  • StoryChapter chapter The chapter object that has been switched to.

loadfile

Called after loading a document.

Parameters:

  • String strFilename The path for the document that was loaded.
  • StoryDocument document The document object that was loaded.

savefile

Called after saving a document.

Parameters:

  • String strFilename The path for the document that was saved.
  • StoryDocument document The document object that was saved.

savezip

Called during document saving. This can be used to save arbitrary data into the nwd file (which is actually just a zip file with contents). See zip saving for more details.

Parameters:

  • String strFilename The filename that the nwd file is being saved to.
  • StoryDocument document The document object that is being saved.
  • ZipFile zip The ZipFile object that you can add new files to.

loadzip

Called during document loading for zip entries that are not recognized by Nimble Writer itself. This can be used to load arbitrary data from the nwd file (which is actually just a zip file with contents). See zip saving for more details.

Parameters:

  • String strFilename The filename that the nwd file is being loaded from.
  • StoryDocument document The document object that is being loaded in its current state.
  • ZipEntry entry The ZipEntry object of the unrecognized file.
  • ZipFile zip The ZipFile object that you can load files from.

usernote.createedit

Called on the loading of the "edit" view on user notes.

Parameters:

  • JsonNote note The usernote object for which this view is intended.
  • Panel panel The panel in which the note's edit controls are.

usernote.createview

Called on the loading of the "view" view on user notes.

Parameters:

  • JsonNote note The usernote object for which this view is intended.
  • Panel panel The panel in which the note's view controls are.

usernote.showedit

Called when user switches to the "edit" view.

Parameters:

  • JsonNote note The usernote object for which this view is intended.
  • Panel panel The panel in which the note's edit controls are.

usernote.showview

Called when user switches to the "view" view.

Parameters:

  • JsonNote note The usernote object for which this view is intended.
  • Panel panel The panel in which the note's view controls are.

usernote.gettext

Called on the fetching of the text of a usernote. In the callback, return the replacement text you'd like to show. If you return nil, it will remain the default value.

Parameters:

  • JsonNote note The usernote object of the related note.
  • string original The original string that would show if the function returns nil.

usernote.getsubtext

Called on the fetching of the subtext of a usernote. In the callback, return the replacement text you'd like to show. If you return nil, it will remain the default value.

Parameters:

  • JsonNote note The usernote object of the related note.
  • string original The original string that would show if the function returns nil.

console.write

Called when the program writes a string to console.

Parameters:

  • String str The string to write to console.

console.writeline

Called when the program writes a line to console.

Parameters:

  • String strLine The line to write to console.