On 7/31/07, Neil Hodgson <[EMAIL PROTECTED]> wrote:
> steve donovan:
>
> > The patch involves changing the signature of ExtensionAPI::DoMenuCommand;
> > in Extender.h around line 30, we then have
> >    virtual void DoMenuCommand(const char *cmd)=0;
>
>    The idea of a published extension interface is to give extension
> writers a solid basis to work. Changing method signatures will make
> existing extensions fail. I'd like people to think about this when
> proposing additions to the extension interface: once its published in
> a release we're stuck with it.

We already have another solution for this task in SciTE Ru-Board edition:
http://scite.ruteam.ru/engine/upfiles/mozers/SciTE-Ru_Kernel.html
(change name is [MenuCommandString])
that didn't change extension interface, only expand it:

add line to Extender.h
        virtual int GetMenuCommandAsInt(const char *commandName)=0;

add line to SciTEBase.h
        virtual int GetMenuCommandAsInt(const char *commandName) { return
GetMenuCommandAsInt(SString(commandName)); }

and change function in LuaExtension.cxx to:
static int cf_scite_menu_command(lua_State *L) {
        if (lua_isnumber(L, 1)) {
                host->DoMenuCommand((int)lua_tonumber(L, 1));
        } else {
                const char *s = luaL_checkstring(L, 1);
                if (s) {
                        int cmdID = host->GetMenuCommandAsInt(s);
                        if (cmdID) {
                                host->DoMenuCommand(cmdID);
                        } else {
                                raise_error(L, "MenuCommand ID not found.");
                        }
                }
        }
        return 0;
}


Maybe, it's more useful solution.

-- 
With best regards,
Vladislav V. Vorob'ev
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to