On Wed, Oct 11, 2006 at 04:04:45PM +0200, Jean-Marc Lasgouttes wrote:
> >>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:
> 
> Abdelrazak> Or course this also means that the "disabled toolbars" bug
> Abdelrazak> comes back. JMarc, I remember you proposed another
> Abdelrazak> solution for that, could you post it again?
> 
> Split FuncRequest::UI into FuncRequest::MENU and FuncRequest::TOOLBAR
> and use these values wisely.

Other approach:

Instead of 

   for (all actions)
     if (getStatus(action))
       do_something_with_action()

   
   Foo::getStatus(action) {
     switch() {
       case ACT1:
       case ACT1:
       case ACT1:
     } 
     or Bar::getStatus(action)...
     perhaps toolbar stuff
   }

use

  vector<ActionData> data (indexed by action)
  Foo::getStatus(data);
  Bar::getStatus(data);
  for (all actions)
    updatAction(act, data[act])
    

  Foo::getStatus(vector<ActionData> & data)
  {
    data[ACT1].setEnabled(true);
    data[ACT2].setEnabled(sometimes).setVisible(perhaps)
    data[TOOLBAR1].setEnabled(...);
  }
      

This gives pretty compact code, fewer function cals and stuff that
influences several LFUNS at once can computed only once. 

Andre'

Reply via email to