Yesterday I asked why the functions in bufferview_funcs are not members of
the appropriate class.
Jurgen replied:
> They are not part of the class because they don't need anything of the
> class. So to hold classes small (which are used over and over) it is better
> to not put such functions into the class (that's as much as I understood
> of what Lars told us ;)
My c++ book (accelerated c++, koenig&moo) states "If the function changes the
state of an object, then it ought to be a member of that object."
Why does this rule not apply here? Or why is this not a good rule?
My second question is about the function ToggleAndShow in bufferview_funcs,
it uses the variable toggleall which is not passed to the function. How does
it work? In the FormCharacter.C I am putting together I need to call
ToggleAndShow. Can I change the declaration to
void ToggleAndShow(BufferView * bv, LyXFont const & font, bool
toggleall=false)
And pass toggleall or should I just put the body of ToggleAndShow in
FormCharacter::Aplly?
Finally, my last question, is about LFUN_FREE which calls the function Free()
which calls UserFreeFont() which depends in turn on the character dialog
through UserFreeFont():
void Free(BufferView * bv)
{
ToggleAndShow(bv, UserFreeFont(bv->buffer()->params));
}
What does this function do? Any ideas on how to make this guii?
Looking forward to some c++ spanking.
Thanks, Ed.