Andre Poenitz wrote:
> On Sat, Aug 31, 2002 at 01:01:13AM +0900, Rob Lahaye wrote:
> 
>>I say: keep the switches for the sake of localization per UI.
>>It's simple and straightforward.
> 
> 
> Than for ${DEITY}s sake, put that conversion into helper functions.
> 

But that function will only be called once, since each conversion switch
appears only once.
Andre, have a closer look at the switch statements. They are unique and
not identical. Each switch statement requires its own helper function!

Moreover, these conversions can NOT be shared by the different GUI's;
each GUI has its own way of connecting the choice items to the enum list.



Are you saying I should do something like:

frnt::OriginType GUI_conversion(int const GUI_choiceItem)
{
        switch (GUI_choiceItem) {
                case 11: return(frnt::RightBaseline);
                case 10: return(frnt::RightBottom);
                [...]
                case  2: return(frnt::LeftTop);
                case  1:
                default:  return(frnt::DefaultOrigin);
        }
} 


int GUI_conversion(frnt::OriginType type)
{
        switch (type) {
                case frnt::RightBaseline: return(11);
                case frnt::RightBottom: return(10);
                [...]
                case frnt::LeftTop: return(2);
                case frnt::DefaultOrigin:
                default: return(1);
        }
}


And then later in the script I call ONCE the first conversion (apply part):
        igp.origin = GUI_conversion(fl_get_choice(extra_->choice_origin));

and ONCE the second function (update part).
        fl_set_choice(extra_->choice_origin, GUI_conversion(igp.origin));

However, I can't see any advantage of having the trouble of making a function,
but calling it only once! Are you still in favour of using such help functions
in this context?

Rob.

Reply via email to