Another possibility is to have a function called in OnNew called DrFrame.PluginOnNew.
In a plugin that wants extra code executed in OnNew,
it must define a function PluginOnNew(DrFrame),
that, if it exists, will be run every time OnNew is called.
What thoughts?
It looks like this may end up turning 3.7.9 into 3.8.0, as it looks like what Franz wants done in drscript will use some common code between drscript dialog and bookmarks dialog (and I can make them inherit from a base class anyway, and reduce the code).
I also may end up using some code for analyzing blocks I've been toying with.
So I might release 3.7.9 a bit early, with just the bugfixes, and hold off on the rest.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You mean in a plugin? :
def OnPreferences(DrFrame):
->some code
#if it is needed
def PluginOnNew(DrFrame):
->some code
def PluginOpenFile(DrFrame):
->some code
then there could be also:
for DrText or rather drSTC:
def PluginStcOnChar and PluginStcOnKeyDown
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Basically, have this create an array to be executed at the start or end of each of these functions.
Can you think of any more?
Also, do you think this would be a performance hinderance? (I am worried about that in the OnChar/KeyDown bits). I think OnOpen is an excellent place (OnSave as well).
AddOnOpenFunction
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok. So fiddling around in SimpleDebugger, I came across a problem. How to add variables to each document without overriding OnNew?
Possibilities are:
A set of arrays, with functions to access them:
DrFrame.GetVariable(DocNumber, VariableName)
DrFrame.AddVariable(DocNumber, VariableName, Value)
Another possibility is to have a function called in OnNew called DrFrame.PluginOnNew.
In a plugin that wants extra code executed in OnNew,
it must define a function PluginOnNew(DrFrame),
that, if it exists, will be run every time OnNew is called.
What thoughts?
It looks like this may end up turning 3.7.9 into 3.8.0, as it looks like what Franz wants done in drscript will use some common code between drscript dialog and bookmarks dialog (and I can make them inherit from a base class anyway, and reduce the code).
I also may end up using some code for analyzing blocks I've been toying with.
So I might release 3.7.9 a bit early, with just the bugfixes, and hold off on the rest.
You mean in a plugin? :
def OnPreferences(DrFrame):
->some code
#if it is needed
def PluginOnNew(DrFrame):
->some code
def PluginOpenFile(DrFrame):
->some code
then there could be also:
for DrText or rather drSTC:
def PluginStcOnChar and PluginStcOnKeyDown
Ok, I think the way to do this is:
AddOnNewFunction(pluginname, functionname, function, ToEnd=True).
Looks like also:
AddOnOpenFunction
AddOnChar
AddOnKeyDown
Same arguments.
Basically, have this create an array to be executed at the start or end of each of these functions.
Can you think of any more?
Also, do you think this would be a performance hinderance? (I am worried about that in the OnChar/KeyDown bits). I think OnOpen is an excellent place (OnSave as well).
AddOnOpenFunction
I only mentioned the OnChar/KeyDown function,
because it could minimize the Keyboard Macros
plugin a lot (no need to overwrite OnOpen and OnNew)