From: Paul Guyot (pguyot_at_kallisys.net)
Date: Fri Jul 11 2003 - 08:51:58 PDT
Il me semble que le 11/07/03 à 10:33 -0500, Jim Witte nous racontait:
> I think that the backdrop buttons register themselves as AuxButtons,
>which automatically show up in Notepad.
Well, I'll bet they just say that they want to be in Notepad.
>I don't know if there's a
>(ready-made) way to disable this, but I'll look into it (of course
>there is - just change a viewSetupFormScript somewhere..)
Well, instead of changing viewSetupFormScript, I'd patch RegAuxButton.
installScript(installPart, removePart)
begin
// Save old RegAuxButton method.
DefGlobalFn('|RegAuxButton:Kallisys|, GetGlobalFn('RegAuxButton);
// Define our patch.
DefGlobalFn('RegAuxButton,
func(inBtnSym, inTemplate)
begin
local theTemplate := inTemplate;
// Force backdrop app instead of Notepad.
if (theTemplate.destApp = 'paperroll) then
begin
// Cloning isn't necessary here
theTemplate := {
_proto: theTemplate,
destApp: nil,
};
end;
// Finally register the button
|RegAuxButton:Kallisys|(inBtnSym, theTemplate);
end);
end;
removeScript(removePart)
begin
// Restore RegAuxButton method.
DefGlobalFn('RegAuxButton, GetGlobalFn('|RegAuxButton:Kallisys|));
// Free up the copy.
UnDefGlobalFn('|RegAuxButton:Kallisys|);
end;
Please note that:
- this is purely untested, I'm not even sure it compiles, but you
have the idea.
- you need to put this into a file and create an auto part with it.
- this isn't perfect as it won't deal well with a software that
patches the RegAuxButton after it. However, it deals well with a
software that patches the function before it. In exchange, it uses
some extra memory once it has been deactivated.
- you might want to have the buttons registered in both places with:
if (theTemplate.destApp = 'paperroll) then
begin
|RegAuxButton:Kallisys|(inBtnSym, {
_proto: theTemplate,
destApp: nil,
});
end;
instead of:
if (theTemplate.destApp = 'paperroll) then
begin
// Cloning isn't necessary here
theTemplate := {
_proto: theTemplate,
destApp: nil,
};
end;
but it might lead to problems.
- this could be an interesting start point for a software that would
let one clone buttons and/or move them to an application they're not
supposed to be an auxbutton of.
Paul
-- Philosophie de baignoire - consultations sur rendez-vous. NPDS: http://newton.kallisys.net:8080/ Apache: http://www.kallisys.com/ -- This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries List FAQ/Etiquette/Terms: http://www.newtontalk.net/faq.html Official Newton FAQ: http://www.chuma.org/newton/faq/
This archive was generated by hypermail 2.1.5 : Fri Jul 11 2003 - 09:00:01 PDT