[sldev] [META] patching design issues

Lawson English lenglish5 at cox.net
Mon Sep 10 12:03:04 PDT 2007


I've created a simple patch that implements this feature request in a 
very wonky way: http://jira.secondlife.com/browse/VWR-2039


It basically allows chat and history to honor the chat size set in 
preferences.


It is wonky, because it goes into the LLTextEditor initialization method 
and special cases the font size there.

I've got a couple of extern global variables it tests to make sure that 
the preset variable object exists before it is used. Those sit in a 
wonkytextfontsizepatch.h file currently.  The wonky code lives in the 
current initialization method inside LLTextEditor::LLTextEditor

I COULD:

1)  keep the wonky code in the existing initialization method.

2) create a new method that is called from within the initialization method

3) create a wrapper method that does the font modification then calls 
the existing text manipulation method, and make sure that all existing 
code uses that wrapper instead of LLTextEditor.

4) create a new LLTextEditor instantiation method and put the wonky code 
in that then pass all args save the original fontsize onto a renamed 
method with all the current code, as is, in the renamed method.





None of these are very nice,. Which is the least not-nice strategy to use?

I'm favoring option 4 as the easiest to maintain:

LLTextEditor::LLTextEditor(blarg)
{
    // test/set font size
    LLTextEditorOld(blarg);
}

LLTextEditor::LLTextEditorOld(blarg){//original code}


Comments? This could be used as a pattern for similar patches, I think.

L.


More information about the SLDev mailing list