[texworks] Scripts: Hooks

Paul A Norman paul.a.norman at gmail.com
Tue Nov 2 10:09:22 CET 2010


P.S. or ...

And in  TWScriptable.cpp
TWScriptManager::getHookScripts(const QString& hook) const

getHook() == hook

could change both sides of boolean test all to lowercase() and avoid
any such issues in ...

if (script->getHook() == hook) {
			result.append(script);
		}

?

Paul

On 2 November 2010 22:05, Paul A Norman <paul.a.norman at gmail.com> wrote:
> Thanks, looking into this a little further ...
>
>>
>> Am 2010-10-31 11:11, schrieb Paul A Norman:
>>> Should add that searching through    TeXDocument.cpp    I have found
>>> these and they all work.
>>>
>>> newFile
>>> newFromTemplate
>>> loadFile
>>> AfterTypeset
>>
>> I think the names should be capitalized (e.g., "LoadFile"). I don't
>> remember off-hand if this is necessary, though. Note that "LoadFile"
>> only works for .tex files ATM.
>> AFAIK, these are all currently implemented hooks.
>>
>
> At the moment in  TeXDocument.cpp  we appear to have a mixed bag,
> three stepped and one all peaked:
>
> void TeXDocument::newFile()
> runHooks("newFile");
> void TeXDocument::newFromTemplate()            doc->runHooks("newFromTemplate");
> void TeXDocument::loadFile(
> runHooks("loadFile");
> void TeXDocument::executeAfterTypesetHooks()
> getScriptManager().getHookScripts("AfterTypeset"))
>
> TWScriptable.cpp
>
> Implements this as
>
> TWScriptable::runHooks(const QString& hookName)
> {
>        foreach (TWScript *s,
> TWApp::instance()->getScriptManager().getHookScripts(hookName)) {
>                runScript(s);
>        }
> }
>
> And TWScriptManager::getHookScripts(const QString& hook) const
>
> also appears to have no case change handling so I assume we will need
> them as specified? Or do you want it on GC for standardization of
> character case structure? Or is it better just to leave it as is for
> backward computability?
>
>  newFile
>  newFromTemplate
>  loadFile
>  AfterTypeset
>
> Paul
>



More information about the texworks mailing list